My requirement is to save the specific are from the GMap. For example, I want to save the location are of NewYork city and once any vehicle entered in this area then we will get an alert. Vehicle updating his information through GPS.
Please suggest me if anyone having some experience about it.
I'm not sure what you mean exactly by "save the specific are from the GMap".
If you mean that you'd like to save a 'viewport' then you could retrieve the viewport coordinates for a particular search and use that as a defined area. Viewports are just large squares though, so this will include areas that are not 'New York City'
If you want to be more precise - i.e. to flag a car as it enters Manhattan, you would need a more detailed KMZ for the Manhattan New York City area.
The New York City Department of City Planning (DCP) provide KMZ's of all the boroughs which could be used to achieve a more accurate view of the area of interest. You could stitch them together to create an 'official' NYC city limits polygon.
https://www.google.com/fusiontables/DataSource?dsrcid=1767628
To determine if a vehicle has entered any of these areas you would need to perform a 'Point-in-Polygon' test against the KML polygon(s).
There are previous discussions on how to do that Here and Here
Hope that helps
Related
I'm using Google Maps Geocode to get the recommended viewport bounding box when displaying countries on a map.
This works really well for almost all countries, and it used to work well for the UK as well.
In the geocoding response, there's the geometry property that includes a viewport property. For the UK this viewport used to include the Great Britain and Northern Ireland, recently, however, it also includes the Akrotiri and Dhekelia territory which is on the island of Cyprus. Fitting the map bounds to this area will display most of Europe.
The solution I've found thus far is to fit the map bounds to the bounding box of Great Britain, this, however, excludes the Northern Ireland which I also want to have visible.
How can I get a bounding box that contains both the Great Britain island Northern Ireland?
I know I can hard code it, it's unlikely to change (unless Scotland decides to go independent). But I would like to find another solution.
The best i could get is this https://jsfiddle.net/7tc0rv2p/1/ (will need to add API key)
You can use:
resultsMap.fitBounds(results[0].geometry.bounds);
resultsMap.panToBounds(results[0].geometry.bounds);
And instead of GB or UK, use England and i found apart from a very minute amount of Scotland it shown the entire part you need, but that should be able to be adjusted if the top of Scotland is absolutely needed.
I realize there are some conceptual gaps in my knowledge—I'm not 100% clear on how everything fits together in Mapbox. Hopefully someone can set me straight and help me achieve what I'm trying to do.
Our client is a multinational corporation with locations divided into global regions: North America, South America, Europe & Africa, Asia Pacific, etc.
What they want is for the initial map view to be a zoomed-out world map. When each of these individual regions are moused over, the countries belonging to that region will be highlighted, a label will be displayed with the name of the region, and clicking will zoom the viewport to center/display the region.
The problem is that there is no concept of a region in the map, and I'm not sure how to add one programatically.
The underlying country map was created and styled by a designer using TileMill. It uses the Natural Earth country map. When I look at the project in TileMill and inspect the layer "features", it appears that the shapefile has a list of the individual countries with some associated metadata. So far so good.
Ideally, on the client side, I would have a list of countries belonging to each region. When the user mouses over an individual country, I'll figure out what region it belongs to, iterate through the country list and apply an effect (like opacity) to highlight the region.
The problem is, I can't figure out how to get the country metadata in the TileMill file for whatever country is currently being moused over. Is it even possible to attach events and access the features added in TileMill?
FYI: an alternate approach I tried was adding this map data at runtime. I was able to attach events to GeoJSON features, but the granularity of the map is WAY lower than the underlying map, so it doesn't line up correctly at higher zoom levels.
The problem is that there is no concept of a region in the map, and I'm not sure how to add one programatically.
Okay, so the fundamental thing to understand here is the difference between interactivity you add in TileMill and interactivity via GeoJSON, in Mapbox.js.
TileMill supports raster interactivity based on UTFGrid, and exports tiles. It can handle high levels of detail and thousands of features, but since the geo data itself is not transferred to your browser, you can't do hover interactions like highlighting data - you can only open tooltips and popups
Mapbox.js/Leaflet support vector interactivity. They can handle much lower levels of detail and amounts of data. But the geo data is transferred to your browser, so you can do hover interactions as well as adding tooltips.
Is there any Javascript API that does not display the entire world map and later allows to zoom and click to individual countries, but instead just displays the country we are interested and allows region-level clicks? In other words, I am looking for an API similar to JVectorMap but this does not have comprehensive support for all countries and it does not show street-level view when zooming further deep into state/city level. I hope my requirements are clear. If I am interested only in let's say England's map, I want the map to show just England but allow state and city-level clicks with street-level or near street-level views at the lowest level as an optional feature (not too many details at the lowest-level). Google Maps, jHERE etc. seem to show the entire world map and allow to zoom-in, which is not something I want.
thanks,
Paddy
If you only want the street maps for one country to be visible, you could download the Open Street Map data into a PostGIS database for that country and that country only, and generate tiles. There are several tutorials on how to download data and make tiles, e.g. http://switch2osm.org/serving-tiles/manually-building-a-tile-server/
I am working on an application where I have some roads in a static vairable (say 7 road names with their address and geolocation). The user of my application would have GPS enabled device so I can retrieve coordinates as where they are standing.
I have user location in longitude and latitude and also 7 addresses in longitude and latitude. I want to select 1 of those 7 addresses matching each with current user location and I am not sure how should I compare to select the nearest one.
Say if user is on Armour Road, Peterborough and as the road is quite long, user can be anywhere at that road resulting in different coordinates. So how can I match user coordinates with that it tells me s/he on Armour Road although no matter where at Armour Road.
How can I check if user is on Armour Road or some other targeted road?
You would prob use a circle-distance algorithm to the distance between all coordinates. When you got which one is the nearest you have a really hard problem to solve. If the user is at the road or nearby, if I understood you correctly.
The people at Yelp! solved this problem by acquiring the coordinates of the road. You always have to mind the error in accuracy which brings you to the point of assuming. If you have two possible roads within the same accuracy you are basically always screwed.
I need to divide USA map into political boundaries. i.e. states and in seven Regional boundaries on Google map. Each region will have its own color. Example, California, Hawaii, Nevada, Utah, Arizona and Colorado (Southwestern US) will all be same color. Political boundaries will also be on map along with regional boundaries. On national view only regional names should be visible and no state name. On zooming in to region state names will be shown, no city name should be visible either I zoom in or out.
Can you please help me understanding that from where should I start? Links? Tutorial?
Do I need an Image to put on map as overlay.
I am really not getting it.
If you want to close this question then please help me that what is the forum to ask this so I put it there?
I need to divide USA map into political boundaries. i.e. states and in seven Regional boundaries on Google map. Each region will have its own color.
You can do this with a relatively simple polygon overlay. You'll need to obtain polygon data for each region of interest from a third party since the API does not provide any.
On zooming in to region state names will be shown, no city name should be visible either I zoom in or out.
This starts to get more complicated. Probably best done using a custom map type (see image map types) if you don't want to see features like city names.
See also
Google Maps w/ counties overlay?
http://maps.forum.nu
State polygon overlay example (for API v2)
MapTiler - Map Tile Cutter
Polymaps - a personal favorite alternative to Google Maps, with a really slick API