How to know If marker crossed polygon on google map - asp.net

I am trying to locate the iPad location. Where as goal is to get alert when user who carrying the iPad should be inside polygon always. How to get alert if provided latitude and longitude crossing the polygon. Any reference link ?

You could use geofence,put a circle on the map set radius and give a condition if its out give a alert.

Related

What's the difference between Map Image and Map Tile?

I don't understand the difference between
https://developer.here.com/documentation/examples/rest/map-image
and
https://developer.here.com/documentation/examples/rest/map-tile
Can someone explain it to me?
The main key difference is that the rendering process. In map image everything happens at the server side(HERE) and in response the only image will be sent back, whereas in map tiles the row data in the JSON format is returned and the rendering of row JSON data happens at client side.
The other key difference is The Mercator Projection, The HERE Map Tile v2 serves map tiles obtained by mapping points on the surface of a sphere (the globe) to points on a plane, using the normalized Mercator projection. For other details please refer the below dev guide.
https://developer.here.com/documentation/map-tile/dev_guide/topics/quick-start-dhc.html
https://developer.here.com/documentation/map-image/dev_guide/topics/display-options.html

Disable Adding Markers to Certain Areas of a Map

I have a map that members can plot points of interest. I would like to be able to add "disabled" areas on the map that prohibits members from adding points to that area.
Example: If I add a point to the US Capitol, no members can add a point within a given radius of that point.
Is this possible?
Yes you can do this. The way to go about it is keep an array of areas which are not allowed.
You can use polygons, or a point with a buffer, from which you will need to create a circle to check it.
You can do this using the Google geometry api. There is a method to check if a point is within a polygon:
google.maps.geometry.poly.containsLocation(point, polygon)
Then as the user clicks on the map to add anew point of interest, in the click event before adding the marker, check to see if that marker location falls within any of the restricted areas, if so don't add the marker, else add the marker.

Google Maps API Display icon along route at a specific distance from start

I want to display virtual progress on a Google map.
I want to display a map with a route and on that route I want to display an icon at some distance (that will be computed based on data) from the start. That distance could change from moment to moment or day to day depending on the data related to the progress along the virtual route.
For instance on a route from LA to NY, one day I may want to display an icon at 772 miles from the start. The distance along the route can be in units or as a percentage.
I have seen the google.maps.IconSequence object, but can't see how to use that with DirectionsService.
A couple of "mile marker/kilometer marker" examples and an animated marker:
every 2 km
2 markers at specific distances along a route
An animated marker along a route

Google Map to Search in Polygon Only

I am making a Google Map (API v3) that searches within a given neighborhood. The neighborhood is not a square but a ton of different points to make a polygon bounding box. I know how to make the polygon but not sure how to get it to search only within the polygon. Below you can see I am using a radius from my center location but I don't need a radius but only a given location.
var request = {
location: centerLatlng,
radius: 800,
types: ["school", "church", "park", "university"]
};
I'm guessing this is a places API request?
https://developers.google.com/maps/documentation/javascript/places
The API doesnt support passing in a artbitary polygon. If you really need to search as such, will just have to do a circle search (as in your example) - and then discard and results that are not in your shape.
Dont think there is a 'is point in side polygon' test in the Maps API itself, but can find code online
https://www.google.com/search?q=point+in+polygon

Highlighting borders of state and cities of US in Google Map API 3

I have a scenario where I have to highlight borders and shade a state or city after geocoding it (when I got the lang and lat).
How can I do this, do I need to have a complete information of a city to surround it with polylines? Or is there a way that map API can do this for me.
True. Google does not provide this feature. So what we can do... we can have the lat/long of the borders of the state. And we have to draw polygons ourselves.
I used this JS object. And changed it to Google map object (google.maps.LatLng).
For example:
var statesobj = {"AK": [new google.maps.LatLng(70.0187, -141.0205),
new google.maps.LatLng(70.1292, -141.7291),
new google.maps.LatLng(70.4515, -144.8163)]}
So, it's easy now. Loop on these lat/longs. And you can draw the polygons on every state of US.
So this is the solution I came up. If you guys know some better idea to do it. Please share.
You can also try Google Geo Charts:
http://code.google.com/apis/chart/interactive/docs/gallery/geochart.html
Google Maps API doesn't allow you to retrieve city borders. There are a couple other places from which you can get the coordinates, though:
Flickr API
There is a Flickr API based on photos that people tag, but it's only as accurate as the people who tag photos: so it's good enough for bootstrapping but probably not for production: http://karya-blog.blogspot.com/2012/12/fetching-city-polygons-with-flickr-api.html
Natural Earth Data
An accurate alternative is www.naturalearthdata.com. To get that data from there you just need to make two requests: one with the city name and one with their ID to get the parameters:
unlock.edina.ac.uk/ws/search?name=berlin&gazetteer=naturalearth&format=json
and then
unlock.edina.ac.uk/ws/footprintLookup?format=json&identifier=14126951
and you're set :)
Mapzen
If it's possible for you to pre-fetch the data, go for Mapzen, they have a full and pretty accurate database: https://mapzen.com/data/borders/
I'm afraid google maps API doesn't provide any means to access region (country, state, city, ...) shapes.
If you want to highlight regions you have to create custom overlays based on data acquired elsewhere.
Now the basic map example includes a "mashup" of data. When identifying data is fed to the web service, the resulting output can pinpoint locations on the map.
It shows how a geographic Map Marker is placed on the map to identify a specific location. Map Markers can use the default icon (shown) or a custom image, gauge, or even a chart. Optionally, the map can be configured to display a Map Marker Info window, containing additional location-specific data, when the marker is clicked.
It includes data-driven, colored regions (in this case, representing postal codes) overlaid a map of eg Washington, DC. Logi Info can work with GIS boundary data to produce region overlays for states, counties, cities, school districts, and other areas. Like the Map Marker, regions can be clicked to display a pop-up information window with detail data.

Resources