As of 2015, is there a way to get the boundaries of an italian post code using Google Maps APIs? - google-maps

I looked at many SO questions referring to a similar topic:
Google Maps API V3: How to get region border coordinates (polyline) data?
Google has started highlighting search areas in Pink color. Is this feature available in Google Maps API 3?
Add "Search Area" outline onto google maps result
Where do Google and Twitter source political boundaries of cities, regions and states?
And searched for online tools and tools within my country and too:
https://market.mashape.com/vanitysoft/boundaries-io/overview
https://market.mashape.com/vanitysoft/boundaries-io
http://mapit.openpolis.it/postcode/00188.html
But no one of them fits with the task I need to complete (and I tell you why right after explaining the task I have to do):
Basically all I want is, for each Italian post code (called CAP in Italy) (as of 2015, they are 8709 and I have them all stored in a database's table), find its area coordinates (therefore something like an array with the following structure (it can be a JSON, KML, XML, it doesn't matter as long as the coords are truthful and I can somehow parse them):
[
[ [lat, lng], [lat, lng], [lat, lng], ... ], // Polygon 1
/*
* This additional arrays may be here in the case
* where a CAP (Italian postal code) is made up of many areas,
* therefore each area is a polygon.
*
* For example here -> https://www.google.it/maps/place/84020+SA/#40.605482,15.1783416,10.32z/data=!4m2!3m1!1s0x13396999456508e7:0x1c09e123127ecbc0
*
*/
[ [lat, lng], [lat, lng], ... ], // Optional Polygon 2
...
[ [lat, lng], [lat, lng], ... ] // Optional Polygon n
];
So that I can draw them with a google.maps.Polygon or a custom overlay extending the google.maps.OverlayView class on a map. The coordinates of the areas I need are shown by Google here:
https://www.google.it/maps/place/20122+Milano/#45.4628212,9.1931976,13z/data=!4m2!3m1!1s0x4786c6af4dceb2f5:0x1c0678057ae1afc0
Or here:
https://www.google.it/maps/place/84020+SA/#40.605482,15.1783416,10.32z/data=!4m2!3m1!1s0x13396999456508e7:0x1c09e123127ecbc0
But I can't find a way to get them in my application and I didn't find such a guide on their site at https://developers.google.com/maps/documentation/. Also, in the SO questions I linked the answers say that Google doesn't provide this data, but, as of 2015, maybe they have changed something?
Now, why no one of the features I have found suits my needs:
They all address to United States' zip codes only;
The local Italian site I have found (mapit.openpolis.it) doesn't return the coords for the polygon area but just the a single pair of lat and lng which points to the center of the postal code and also doesn't return anything for some postal codes (CAPs).
What could I do? Is there a way to contact a responsible of the Google Maps API team and ask him what should I do in such a case? (And I am pretty serious so don't laugh at me...).
Thanks for the attention.

You can check out the postal boundaries from open street map.

Related

Unsure of which API or library to get existing hiking trail coordinates/data

I'm prototyping a google maps application and I would like to obtain the series of lat/long coordinates that make up an existing hiking trail that google maps already has drawn on a given map. See the screen shot, but how would I obtain the data (ie. lat/long cordinates) on the Wonderland Trail in the screen shot. Is that a polyline, a road or something else? I tried the Roads API (both snapToRoad and nearestRoads) with a series of coordinates around the Wonderland Trail and was receiving empty responses from the API. I've searched up and down the reference docs and on this site and can't seem to pinpoint the API or library I need to use or even what type of "map element" a trail is considered to be. One item of note, and is the reason I was drawn towards the Roads API is when I toggle my map style visibility settings for arterial road labels:
{ featureType: 'roads.arterial', elementType: 'labels', stylers: [{ visibility: 'off'}}
The label on the "wonderland trail" in the screen shot disappears. Comes back when I toggle back to on. This would lead me to believe that Google Maps construct for this map element is a road. Any guidance on this would be greatly appreciated.
I’m unsure why #MrUpsidown didn’t post his answer as an answer but, what he said does in fact work. If you need data about an existing route (whether that is a road, trail or some existing navigation construct) the Directions Service (DirectionsService in JavaScript) does appear to be the place to go.

How to place Google maps street view panorama in tunnel with bridge

Is there a way to tell google maps street view you want to be above/under another road? I have a path that takes someone around a cloverleaf and back out the other way, but when I set the location on the bridge it always sets them to on top of the bridge.
current code
lineClickEventHandler(latLng: google.maps.LatLng) {
this.panoramaMap.setPosition(latLng)
this.drivingData.heading = Math.round(this.routeService.getCurrentHeading(latLng, this.polyLine))
this.panoramaMap.setPov({
heading: this.drivingData.heading,
pitch: 0
})
Afaik there is no way to select a level for a set of coordinates.
If you are following a Street View "path" on the below level and don't want the API to "move" you to the top road, you could use the returned links of the current panorama you are on.
As stated in the documentation each panorama has links to adjacent panoramas in the form of a collection of StreetViewLink objects.
The getLinks() method of the StreetViewPanorama class will return the same collection.
For example:
0: {description: "", heading: 97.73429107666016, pano: "zVIPHTGA5Pu4os139DS5sw"}
1: {description: "", heading: 277.2002563476562, pano: "wSLR0N4qAw-_Ib2Q69HvTw"}
If you know your heading (more or less) or say, the direction you are currently intending to move, you could compare it with the heading contained in the links and load the corresponding adjacent pano by its id.
Hope this helps.
Edit:
I did a small proof of concept to see if I could follow that road automatically based on a base heading and the provided StreetViewLink objects but unfortunately that seems buggy...
For some reason — and although Street View imagery is available to continue "straight ahead" on the same road — the adjacent links somehow start referencing the top road at some point. I don't know why this happens.
Here is my fiddle. Watch your javascript console and the map while it moves along the road.
It would be interesting to test that in other places and figure out if this is a local issue or if it happens in other places as well... My guess is that it will happen in other places too.

Adding the marker to Google Maps external link

I have website that uses Google maps to plot the location of registered businesses. This uses javascript and shows the orange marker to pinpoint the exact location. I'm trying to build a link to the actual google maps page and my code is doing what I want it to except the marker doesn't show up. Is there another peice of code I can add to this to make it show up?
Full Sized Map
To add a pin you need the q parameter. It holds q=latitude+longitude+(url-encoded-text)
Here is an example of hybrid map with weather - pin at Embassy Suites, map centered on Horseshoe Falls
https://maps.google.com/maps?hl=en&ll=43.076,-79.074&spn=0.0212,0.0496&t=h&z=16&q=43.0795N+79.0818W+(Nice%20Hotel)&lci=weather
hl= two letter language code
ll= the map center using coma
separated +/- values
spn= the viewport span in degrees, works with
the z parameter
t= map type {m|k|h|p}
z= is the zoom factor
q= latitude+longitude+(url-encoded-text), the lat/lon in q have to be
followed by a letter - N/S or E/W instead of using +/-
lci= special codes, coma separated - i know of weather, transit_comp, com.panoramio.all
layer= additional layers, e.g. t for traffic
Google is changing things with the new Google Maps and a lot of functionality has been removed/replaced. You can check the new Maps Engine here http://mapsengine.google.com/map/

Google maps search by address component

I have implemented a basic google places autocomplete in my web app, for example saying "Heraclion, Crete" and it translates it to the latlng coordinates that I want. I also used the mysql radius example from the api to show nearest entries. I also have locations in a second area of Crete, called "Rethymnon".
The problem now is the following. Supposedly one types just Crete. How can I get all the entries from Heraclion and Rethymnon? My code uses the radius approach as mentioned before. So I need something else to define it in a rectangular area.
Is this possible?
If the result contains a viewport (LatLngBounds), you could use that.
PlaceResult
geometry: The Place's geometry-related information. This includes:
location provides the latitude and longitude of the Place.
viewport defines the preferred viewport on the map when viewing this Place

What parameters should I use in a Google Maps URL to go to a lat-lon?

I would like to produce a url for Google Maps that goes to a specific latitude and longitude. Now, I generate a url such as this:
http://maps.google.com/maps?z=11&t=k&q=58 41.881N 152 31.324W
The resulting map comes up with a round "A" balloon pointer, which seems to point to the nearest named object, and a green arrow, which points to the lat-lon. Sometimes, as in this example, the "A" pointer is centered and is far enough away that you cannot see the pointer to the lat-lon. (Zoom out to see both pointers in this example. The "A" pointer is in the center of Alaska, while the lat-long pointer is on Kodiak Island.)
Are there some parameters I can use in the Google Maps URL that will produce a single pointer to a designated lat-lon? (This loads in a separate window. It is not embedded.)
This is current accepted way to link to a specific lat lon (rather than search for the nearest object).
http://maps.google.com/maps?z=12&t=m&q=loc:38.9419+-78.3020
z is the zoom level (1-20)
t is the map type ("m" map, "k" satellite, "h" hybrid, "p" terrain, "e" GoogleEarth)
q is the search query, if it is prefixed by loc: then google assumes it is a lat lon separated by a +
yeah I had the same question for a long time and I found the perfect one. here are some parameters from it.
https://maps.google.com?parameter = value
q=
is used to specify the search query in Google maps search.
eg :
https://maps.google.com?q=newyork or
https://maps.google.com?q=51.03841,-114.01679
near=
is used to specify the location alternative to q=. Also has the added effect of allowing you to increase the AddressDetails Accuracy value by being more precise. Mostly only useful if query is a business or suchlike.
z=
Zoom level. Can be set 19 normally, but in certain cases can go up to 23.
ll=
Latitude and longitude of the map centre point. Must be in that order.
Requires decimal format. Interestingly, you can use this without q, in
which case it doesn’t show a marker.
sll=
Similar to ll, only this sets the lat/long of the centre point for a business search. Requires the same input criteria as ll.
t=
Sets the kind of map shown. Can be set to:
m – normal map,
k – satellite,
h – hybrid,
p – terrain
saddr=
Sets the starting point for directions searches. You can also add text into this in brackets to bold it in the directions sidebar.
daddr=
Sets the end point for directions searches, and again will bold any text added in brackets.You can also add "+to:" which will set via points. These can be added multiple times.
via=
Allows you to insert via points in directions. Must be in CSV format. For example, via=1,5 addresses 1 and 5 will be via points without entries in the sidebar. The start point (which is set as 0), and 2, 3 and 4 will all show full addresses.
doflg=
Changes the units used to measure distance (will default to the standard unit in country of origin). Change to ptk for metric or ptm for imperial.
msa=
Does stuff with My Maps. Set to 0 show defined My Maps, b to turn the My Maps sidebar on, 1 to show the My Maps tab on its own, or 2 to go to the new My Map creator form.
dirflg=
can set miscellaneous values below:
h - Avoid highway
t - Avoid tolls
reference
http://moz.com/ugc/everything-you-never-wanted-to-know-about-google-maps-parameters
In May 2017 Google announced the Google Maps URLs API that allows to construct universal cross-platform links. Now you can open Google maps on web, Android or iOS using the same URL string in form:
https://www.google.com/maps/search/?api=1&parameters
There are several modes that you can use: search, directions, show map and show street view.
So you can use something like
https://www.google.com/maps/search/?api=1&query=58.698017,-152.522067
to open map and place marker on some lat and lng.
For further details please refer to:
https://developers.google.com/maps/documentation/urls/guide
This should help with the new Google Maps:
https://maps.google.com/maps/place/<name>/#<lat>,<long>,15z/data=<mode-value>
The place adds a marker.
name could be a search term like "realtors"/"lawyers".
lat and long are the coordinates in decimal format and in that order.
15z sets zoom level to 15 (must be between 1 ~ 20).
You can enforce a particular view mode (map is default) - earth or terrain by adding these:
Terrain: /data=!5m1!1e4
Earth: /data=!3m1!1e3
E.g.: https://www.google.com/maps/place/Lawyer/#48.8187768,2.3792362,15z/data=!3m1!1e3
References:
https://moz.com/blog/new-google-maps-url-parameters
http://dddavemaps.blogspot.in/2015/07/google-maps-url-tricks.html
The following works as of April 2014. Delimiting each component of the URL with + and & for spaces and addition statements, respectively.
Full HTML:
<iframe src="http://maps.google.com/maps?q=Scottish+Rite+Hamilton+ON&loc:43.25911+-79.879494&z=15&output=embed"></iframe>
Broken down:
http://maps.google.com/maps?q=
where ?q= starts the general search, which I provide a venue, city, province info using + for spaces.
Scottish+Rite+Hamilton+ON
Next the geo-data. Lat and lng.
&loc:43.25911+-79.879494
Zoom level
&z=15
Required for iframes:
&output=embed
http://maps.google.com/maps?q=58%2041.881N%20152%2031.324W
Just use the coordinates as q-parameter. Strip the z and t prameters. While z should actually just be the zoom level, it seems that it won't work if you set any.
t is the map type. Having that said, it's not obvious how those parameters would affect the result in the shown way. But they do.
Maybe you should try the ll-parameter, but only decimal format will be accepted.
You can find a quick overview of all the parameters here.
If you need a name on your pin, you can also use:
http://maps.google.com/?q=MY%20LOCATION#lat,long
All the answers didn't work for me (the loc: and # options). So here is my solution for the new Google maps (April 2014)
Use the q= for query description, for example the street or the name of the place.
Use ll= for the lat, long coordinates.
You can add extra parameters like t=h (hybrid) and z=19 (zoom)
https://maps.google.com/?q=11+wall+street+new+york&ll=40.7060471,-74.0088901
https://maps.google.com/?q=new+york+stock+exchange&ll=40.7060471,-74.0088901
https://maps.google.com/?q=new+york+stock+exchange&ll=40.7060471,-74.0088901&t=h&z=19
There have been a number of changes, some incompatible, since I asked this question 5 years ago. Currently, the following works properly:
https://www.google.com/maps/place/58°41.881N 152°31.324W/#58.698017,-152.522067,12z/
The first latitude/longitude will be used for the pin location and label. It can be in degrees-minutes-seconds, degrees-minutes, or degrees. The second latitude/longitude (following the "#") is the map center. It must be in degrees only in order for the zoom (12z) to be recognized.
For terrain view, you can append "data=!4m2!3m1!1s0x0:0x0!5m1!1e4". I can find no documentation on this, though, so the spec could change.
New Version queries have a different format
To reach a lat long by url use (e.g.)
https://www.google.com/maps/search/-15.924,-5.719
works fine
https://maps.google.de/maps?q=51.404989,13.091751&z=17&t=k
This doesn't have to be much more complicated than passing in a value for the 'q' parameter. Google is a search engine after all and can handle the same stuff it handles when users type queries into its text boxes
"maps.google.com?/q=32.5234,-78.23432"
This works to zoom into an area more then drop a pin:
https://www.google.com/maps/#30.2,17.9820525,9z
And the params are:
#lat,lng,zoom
If you only have degrees minutes seconds you can pass them on the url :
https://maps.google.com/maps?q=latDegrees latMinutes latSeconds longDegrees longMinutes longSeconds
substitute in %20 for the spaces
"ll" worked best for me, see:
http://mapki.com/wiki/Google_Map_Parameters (query reference)
it shall not be too hard to convert minutes, seconds to decimal
http://en.wikipedia.org/wiki/Decimal_degrees
for a marker, possibly the best would be ?q=Description#lat,long