check if polygon is self intersecting google maps v3 - google-maps-api-3

i want to check if the polygon is self intersecting. After the event "polygoncomplete" is fired, this check should be done. Any ideas how to solve this problem?

Related

How to know If marker crossed polygon on google map

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.

Use containsLocation with Fusiontable point layer and drawn polygon

I would like to be able to select all points from a fusiontable layer that are within a drawn polygon in google maps api 3.
I know in Google Maps API v3 there is the containsLocation method in geometry library, but I dont know how to extract lat/lon from the fusiontable layer and make a loop that will scan over all the markers in the layer.
Thank you very much if you can help with that.
You can extract the data from the FusionTable using the FusionTables API v1.
Example that extracts kml "Points" from a FusionTable and displays them as markers

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

Finding streets (get their coordinates) and calculating distances between markers

I have trouble finding any information on how to use the API to:
Search for streets and get some clickable results that returns a LatLng object or something (at least coordinates). So If I search for a street and click on a result, I'll pan to that street (for example).
How can I calculate distance between markers? and possibly, draw lines between them.
All I get is the API but no guides so it's fairly hard figuring out what types to use.
Here is a fiddle showing how this can be achieved:
http://jsfiddle.net/foxwisp/vQGMr/1/
To convert street names to lat/lng you need to use a Geocoder such as the one provided by Google Maps API.
Then, when you get back the results from the geocode, you use the lat lng properties to create a marker. Once your first marker is placed, you repeat the process for your second street address. We nest these calls so that we can be assured of the order of execution due to their asynchronous nature.
Once we have our second marker we use Google's polyline function to draw a line between the two latlng marker points.
Then we use a slightly complicated mathematical equation to do some distance calculations and voila.
The Google Maps API is fantastically documented, hopefully this fiddle will put it into context for you and you can explore each element step by step by reviewing functions and properties in the documentation

Boundaries in Google Map

I am using Google Maps for my website and I want to create boundaries of towns and cities, as shown in the screenshot below.
Problem: There seems not to be any feature in the V3 API to perform this function. I believe it involves retrieving the Latlng of the path that forms a polygon around the area.
How then do you get the Latlng of the points needed?
Screenshot
ok, assuming you already have a path defined as a Polyline, you can then call the .getPath() function which returns an MVCArray of LatLng objects. I assume that answers your question "How then do you get the Latlng of the points needed?"

Resources