Before you read anything else:
I'm aware that a derivative (integral, maybe?) of this question has been asked before (see here and here), but this question asks a little bit more than either of those. In addition, the two of those are a bit out of date.
The Important Stuff
So here's the question(s):
Is there a reliable Google Maps .NET wrapper that supports polygons and spatial searches (the containsLocation() method)?
If there isn't, can anybody point me in the right direction to get started writing my own? Specifically the polygon/searching stuff.
Additional Reading
There are a couple of reasons I want to do this. First off, I'm developing a mobile site, and I don't want to overload the client with a bunch of javascript. Second -- I don't actually need to display the map at all. All I really need to do is plot the polygons on the map and search for lat/long coordinates inside the shapes.
Here is one that I found: https://gmaps.codeplex.com/
It does not look like it has been touched in some time but should help you get started.
For Place Search (Places API), Google Maps API supports proximity search by specifying circular / rectangular range for a location bias parameter. Note that it is not supporting generic polygons and spatial searches as OP asked.
locationbias — Prefer results in a specified area, by specifying
either a radius plus lat/lng, or two lat/lng pairs representing the
points of a rectangle. If this parameter is not specified, the API
uses IP address biasing by default.
https://developers.google.com/places/web-service/search
Places are defined within this API as establishments, geographic
locations, or prominent points of interest.
The Places API lets you search for place information using a variety
of categories, including establishments, prominent points of interest,
and geographic locations. You can search for places either by
proximity or a text string. A Place Search returns a list of places
along with summary information about each place; additional
information is available via a Place Details query.
.NET wrapper libraries for the Google Maps API (including Places API):
GoogleApi
google-maps
https://stackoverflow.com/a/61531795
Related
I have a Polygon (a sequence of 2D-points) loaded (I can parse from GPX, Google polyline and GeoJson) in my C# program. And I have around 1000 of 'segments' that also are GeoJson Linestrings.
Some of these segments are 'far away' off the track, while others could perfectly intersect with the track. My question is what the fastest way (ideally using an existing in memory library) would be to detect which segments are part of the overall track. (The points obviously don't have to match 100%, but can be a few meters off the track)
Consider the situation where I have a recorded GPS-track (of a car for example) and I want to check against a library of streets if that track has been driving through those streets. (ideally in the specified direction, if possible)
So, my main questions:
Is there an out of the box open source library available that has implemented this?
If not, I'm happy to contribute it, but then I'm looking for a good description of such an algorithm.
Further clarification
I have indeed found several options to work out if a point is inside , or on a polygon. (see here).
But the main challenge is to find out if someone has done this before in .net and to understand if there are out of the box possibilities for this.
Any help is appreciated.
Despite Googling around a fair amount, the only things that surfaced were on neural networks and using existing APIs to find tags about an image, and on webcam tracking.
What I would like to do is create my own data set for some objects (a database containing the images of a product (or a fingerprint of each image), and manufacturer information about the product), and then use some combination of machine learning and object detection to find if a given image contains any product from the data I've collected.
For example, I would like to take a picture of a chair and compare that to some data to find which chair is most likely in the picture from the chairs in my database.
What would be an approach to tackling this problem? I have already considered using OpenCV, and feel that this is a starting point and probably how I'll detect the object, but I've not found how to use this to solve my problem.
I think in the end it doesn't matter what tool you use to tackle your problem. You will probably need some kind of machine learning. It's hard to say which method would result in the best detection, for this I'd recommend to use a tool like weka. It's a collection of multiple machine learning algorithms and lets you easily try out what works best for you.
Before you can start trying out the machine learning you will first need to extract some features out of your dataset. Since you can hardly compare the images pixel by pixel which would result in huge computational effort and does not even necessarily provide the needed results. Try to extract features which make your images unique, like average colour or brightness, maybe try to extract some shapes or sizes out of the image. So in the end you will feed your algorithm just with the features you extracted out of your images and not the images itself.
Which are good features is hard to define, it depends on your special case. Generally it helps to have not just one but multiple features covering completely different aspects of the image. To extract the features you could use openCV, or any other image processing tool you like. Get the features of all images in your dataset and get started with the machine learning.
From what I understood, you want to build a Content Based Image Retrieval system.
There are plenty of methods to do this. What defines the best method to solve your problem has to do with:
the type of objects you want to recognize,
the type of images that will be introduced to search the objects,
the priorities of your system (efficiency, robustness, etc.).
You gave the example of recognizing chairs. In your system which would be the determining factor for selecting the most similar chair? The color of the chair? The shape of the chair? These are typical question that you have to answer before choosing the method.
Either way one of the most used methods to solve such problems is the Bag-of-Words model (also Referred the Bag of Features). I wish I could help more but for that I need that you explain it better which are the final goals of your work / project.
Since NodaTime already has lat/long and country code data within the olson database, I was wondering if we can specify any lat/long (say any lat/long returned by GeoLocator.GetGeopositionAsync in windows store apps) and determine the timezone and country code from it?
Something similar to this: var zone = session.GetZoneForLocation(latitude, longitude); This is from https://github.com/mj1856/Raven.TimeZones
I am specifically looking at an offline solution like NodaTime and not using web services.
The lat/lon data that exists within NodaTime comes from the zone.tab file in the Olson data. This gives the location of the point on the map that the zone uses as a reference.
If that was the only data you had available, the best you could do for an arbitrary location would be to find the closest point. In some cases, this will give you an accurate time zone, but in many cases it will not.
Consider the following example (and please excuse my poor artwork)
The two squares represent different time zones, where the black dot in each square is the reference location, such as what you would find in zone.tab. The blue dot represents the location you are going to pass to the input query. Clearly, this location is within the orange zone on the left, but if we just look at closest distance to the reference point, it will resolve to the greenish zone on the right.
So zone.tab data (such as found in Noda Time) is not sufficient to perform this operation. Instead we need something that describes zones in terms of the shapes that define their boundaries, not just a single point. Fortunately, Eric Muller has been so kind to provide these shapes and put them in the public domain. You can find this data here.
My Raven.TimeZones project that you found does exactly that. It imports the data from Eric's shapefiles, and uses the geospatial features of RavenDB to index and query that data.
You can certainly use my implementation directly, or copy from it whatever parts you need. It works completely offline, making no web service calls. But it does require a license of RavenDB to operate.
If you are not able to use RavenDB, you can probably take a similar approach using any other database that supports complex spatial queries.
In particular - RavenDB cannot currently run in a pure WinRT environment, so you won't be able to use this directly in a Windows Store app. I'm uncertain if there are any embedded databases for WinRT that can perform geospatial queries. If anyone knows if any, please let us know.
Update
A consolidated list of time zone lookup methods can be found here.
I've a requirement in which i need to show optimal road route related to a fixed location within a map by giving few postcodes, fetched from database on the basis of some conditions, as input.
The route should be shown as the least distanced postcode first order from the fixed location.
How can i implement using asp.net?
Can i use Google-map api to implement this?
If you want to use Google's database of roads, you have their API: http://code.google.com/apis/maps/documentation/directions/
https://maps.googleapis.com/maps/api/directions/output?parameters
Their API is very well documented, so checking that out would be a great start. The output is available in XML and JSON, and it includes the waypoints which you are looking for.
I've been reading about using the winged-edge data structure for storing a boundary representation. However, the linked site says that this is one of the oldest data structres for storing b-reps, are there newer better ones?
Secondly, is there an implementation of this in C#?
The datastructure used for a B-rep is very similar to those used for polygonal modeling - you just replace the edges with curves and the faces with surfaces.
The wikipedia page on polygonal meshes has several types listed, including winged edge. Personally I like half-edge meshes. The only thing they can't do well is non-manifold topology, which you may or may not need. If you do, look for radial edge topology.
There's also a freely available B-rep datastructure from OpenNurbs (McNeel, the makers of Rhino). That also gets you file IO, which is nice.
Boundary Representation Modelling Techniques by Ian Stroud will give you a survey of ways people have approached B-reps, along with a plethora of diagrams with all the Euler operators, and concrete data structures and algorithms for implementing B-reps imperatively.
Whether you want to move a few characters forward into F# or not, you may glean quite a bit of info from the source code for Wings3d (written in Erlang). Just don't get lost making spaceships and forget you were supposed to be coding!
Also the GML will allow you to investigate interactively what you can do with your B-reps, and the data structure is the code.
Not sure if this will help or not but there are Geometry objects in the XNA library for dealing with 3D Structures and what not. There may be something in there. However my guess is that it will either be Point based or Triangle based vs edge based.
But it might be a place to look.