So, I'm trying to draw google maps's polygon for every states in the US.
It's quite simple for colorado but it's getting more complicated for coast states or Hawaii.
I basically need to to draw multiple polygons in one. The idea is to add an opacity on mouse over. So for example when someone mouse over one of the islands of Hawaii, I want to add opacity on all the islands.
Any idea how to do this ?
A google.maps.Polygon takes an array of paths.
example using geoxml3 to create a multi-part polygon of Hawaii
Related
Using geojson.io page I want to draw some districts/countries.
I'm drawing each district separately as there is no multipolygons in Leaflet Draw. However when I'm drawing the borders even with maximum zoom - the borders will never be exactly the same. Coordinates will differ to some extend which is natural. Hence when I am downloading the data in topojson , the data are not valid to display meshes between different districts
How to achieve the goal to have the borders always with the same coordinates?
For example it could be achieved by having the markers visible during drawing and just picking up the one I'm interested in(on a same border) by mouse click - the same way the shape is finished.
I have downloaded the source code, read it (it is nice), searched through docs and thinking how to adjust it for my goal but I'm lost :/
Leaflet.Snap did the trick.
I was afraid that snapping will be not exact for the borders but it is :)
I have a geoJson data layer of the world from naturalearthdata.com and a working map based on countries (features) with hover colors setup. I want to group the data on continents, so I'd end up with Europe, Americas, Aftrica and Middle East, Asia & Australia.
There doesn't seem to be any examples of this - I wouldn't think I need to change the data since all countries have the continent property. Whats best practice to achieve this?
Just to update, I decided to alter the .shp file in QGIS and merge the individual features to make these larger regions. Took a load of tidying up stray lines with the Node tool but this produced what I needed.
I am willing to highlight a state in the Google maps when user click on any area in the particular state. Supprose if I click on any area in the Washington sate. Then the Washington should be highlighted. Can you help me if any api or js is available to do like that.
There is no automatic API for this. You are going to have to draw a polygon either dynamically when the user clicks, or pre-draw all the U.S. State polygons in advance and hidden, then dynamically make the proper one visible when the user clicks.
As for making polygons in the shape of at least U.S. states, several persons have posted pre-defined polygon lists. One is here in StackOverflow: Geographical boundaries of states/provinces -> Google Maps Polygon
However, if you are looking at world-wide regions, states, and provinces, I doubt you will find pre-defined lists of them all. You may well have to create your own polygons by manually drawing on a Google Map or Google Earth, then export the polygon's lat/lng waypoints.
recently I am creating some relative, the tests I made was based on OpenStreetMap Nominatim (https://wiki.openstreetmap.org/wiki/Nominatim), is something like:
Click on map get Lat, Lng
Search by reverse Geocode, get state (or city)
Use Nominatim API to get a polygon_text (I use the geo WKT format), parse it
Draw the polygon or polygons (if multiplygon) with Google Maps API
Hope it could make some ideas come.
I am having some strange behavior with my leafletjs map. I've tried plotting a few polylines between north america and asia, but get the polyline split into two pieces.
Is there a way to fix this?
You did not add any code with your request so it is no easy to respond you correctly
Likely you need to split each polyline in two parts, else they directly jump to the other part of the world passing over the europe. Then try to center the map on the pacific ocean and not in the europe in order to get a better map.
I need to show my clients what 'zone' they live in (how much they will pay depending on how far away they are from my business). I want to use Google Maps to give them a view of what roads/towns/cities/etc. are in what zone. I was going to make some kind of definable barrier of sorts that would emanate from the center point.
I would have it so one barrier line showed where it was x miles away from the center point, another barrier would define areas y miles away, another defining areas z miles away, and so on and so forth.
I've never used the Google API and I'm only slightly good at Javascript... What is the best path to take here to learning how to do this... or... even better... how would I do this?
Thanks for helping!
Cheers!
You can create polygons on the map and set the fill shading opacity such that it is slightly transparent. When you layer concentric circles over one another, you'll see the shading change slightly.
I wrote a series of posts on how to use the maps API for Google, Bing, and MapQuest that you might find useful.
http://www.onesadjam.com/search/label/mapping
Look at the documentation on google maps javascript api V3. I sense that you will be creating polygons - specifically look at how to do that. In the API, you can create a circle polygon, with options such as the center and radius, making your job very easy.