Al buscar en Google Maps una ciudad, se muestra el límite administrativo de la ciudad.
¿Hay alguna manera de obtener los límites de los polígonos de City en formato JSON utilizando la API de Google Maps?
Al buscar en Google Maps una ciudad, se muestra el límite administrativo de la ciudad.
¿Hay alguna manera de obtener los límites de los polígonos de City en formato JSON utilizando la API de Google Maps?
Respuestas:
Puede obtener coordenadas de polígono en json para usar con googlemaps usando openstreetmap. Vaya a http://nominatim.openstreetmap.org/ busque un lugar como "Partido de Ituzaingó"
haga clic en "detalles"
Busque el ID de OSM y cópielo (control + c), ejemplo: 2018776
pegue la ID en http://polygons.openstreetmap.fr/index.py y descargue el polígono
5638803
, cuando corro global.mapit.mysociety.org/code/osm_rel/5638803 I get{"code": 404, "error": "No areas were found that matched code osm_rel = 5638803."}
Para obtener límites de polígonos, simplemente agregue format=json
a su solicitud.
Entonces, en lugar de https://nominatim.openstreetmap.org/search.php?q=Warsaw+Poland&polygon_geojson=1
utilizar
https://nominatim.openstreetmap.org/search.php?q=Warsaw+Poland&polygon_geojson=1&format=json
Al agregar & format = geojson puede obtener una respuesta válida de geojson
No, no hay forma de robar los datos de Google. Puede ser que puedas mirar OpenStreetMap, que está diseñado para que la gente lo descargue.
He encontrado una solución alternativa para este problema.
Puede usar datos largos y largos y analizarlos en una matriz. Esta solución está funcionando bien, pero la calidad del camino a veces es difícil.
Como alternativa a la API de Google Maps, OpenStreetMap puede ayudarlo a buscar una ciudad por su nombre en esta página http://nominatim.openstreetmap.org/ . Luego revise los resultados de búsqueda, y puede obtener las coordenadas de la región en formato GeoJSON, por ejemplo ( http://nominatim.openstreetmap.org/details.php?place_id=145126778 ) para obtener las coordenadas mashhad geojson en la pestaña Administrativo
Obtenga coordenadas exactas de los límites de ubicación como la búsqueda de Google en formato json.
Vista del mapa: http://theopenmap.herokuapp.com/
POST: http://theopenmap.herokuapp.com/api/v2_coordinates/
{"location": "enter your location"}
Respuesta:[
[
31.1038963,
77.1028804
],
[
31.0756716,
77.11867319999999
],
[
31.0717018,
77.1523188
],
[
31.0450854,
77.1815013
],
[
31.0705256,
77.2127436
],
[
31.1103633,
77.223215
],
[
31.1265289,
77.2034739
],
[
31.1222673,
77.1181582
],
[
31.1038963,
77.1028804
],
[
31.2883822,
78.2982197
],
[
31.2977484,
78.2803793
],
[
31.320049,
78.2866234
],
[
31.3285232,
78.2768112
],
[
31.3325373,
78.2446983
],
[
31.3468097,
78.229534
],
[
31.3303072,
78.1996512
],
[
31.3490397,
78.14925189999998
],
[
31.3646501,
78.13810159999998
],
[
31.3829366,
78.1510359
],
[
31.3882887,
78.1479139
],
[
31.4141574,
78.0952845
],
[
31.4244156,
78.0881483
],
[
31.4230776,
78.0395331
],
[
31.4052371,
78.0092043
],
[
31.4070212,
77.9485468
],
[
31.4186175,
77.9454247
],
[
31.4288758,
77.9128658
],
[
31.4476082,
77.8874432
],
[
31.4609886,
77.8829831
],
[
31.4752609,
77.8646966
],
[
31.4913174,
77.8673727
],
[
31.5082658,
77.8544383
],
[
31.515848,
77.8441801
],
[
31.5100498,
77.840612
],
[
31.5113879,
77.8254476
],
[
31.5314584,
77.8299077
],
[
31.5671393,
77.8200955
],
[
31.5836417,
77.8236636
],
[
31.6153085,
77.7986869
],
[
31.6420692,
77.8093912
],
[
31.6674919,
77.7964569
],
[
31.6777501,
77.7790624
],
[
31.6911305,
77.7741563
],
[
31.7076329,
77.7563158
],
[
31.7178912,
77.7353533
],
[
31.7187832,
77.7192969
],
[
31.7067409,
77.6934282
],
[
31.7076329,
77.6702356
],
[
31.6643698,
77.6332167
],
[
31.6385011,
77.6479351
],
[
31.633149,
77.6381228
],
[
31.6170926,
77.6332167
],
[
31.5823037,
77.6407989
],
[
31.5461768,
77.684062
],
[
31.5064817,
77.6938742
],
[
31.4667867,
77.6559633
],
[
31.4502843,
77.6131462
],
[
31.4275377,
77.60824
],
[
31.4016691,
77.6189443
],
[
31.3949789,
77.6149302
],
[
31.399439,
77.5765732
],
[
31.3905188,
77.5565027
],
[
31.3905188,
77.5391083
],
[
31.3552839,
77.5110095
],
[
31.36019,
77.4838028
],
[
31.3454716,
77.4151171
],
[
31.3659881,
77.38746439999998
],
[
31.3650961,
77.371854
],
[
31.3557299,
77.3433092
],
[
31.3267391,
77.32680679999999
],
[
31.3022085,
77.3219007
],
[
31.2754478,
77.2911259
],
[
31.2696497,
77.2683793
],
[
31.2794619,
77.255891
],
[
31.2580534,
77.2340364
],
[
31.2638515,
77.2050457
],
[
31.2482411,
77.1903273
],
[
31.2482411,
77.1822991
],
[
31.2589454,
77.1756089
],
[
31.2344148,
77.1475102
],
[
31.2326307,
77.1180735
],
[
31.2509172,
77.1073692
],
[
31.2518092,
77.0690122
],
[
31.3013165,
76.9887302
],
[
31.2754478,
77.00077249999998
],
[
31.2406589,
76.9905142
],
[
31.2375369,
76.9985424
],
[
31.2223725,
77.0056786
],
[
31.2246025,
77.0297632
],
[
31.1978418,
77.0551859
],
[
31.1965038,
77.0632141
],
[
31.2067621,
77.0779324
],
[
31.1728652,
77.0948809
],
[
31.1750952,
77.1332379
],
[
31.1599309,
77.15821449999999
],
[
31.1920437,
77.2050457
],
[
31.1398603,
77.2460788
],
[
31.1425364,
77.2701634
],
[
31.12648,
77.2808676
],
[
31.0912451,
77.2616892
],
[
31.0939212,
77.2701634
],
[
31.085447,
77.2875578
],
[
31.0684985,
77.2772996
],
[
31.0511041,
77.2790836
],
[
30.9984747,
77.2996001
],
[
30.9944606,
77.3076283
],
[
30.9797422,
77.3031682
],
[
31.0051649,
77.3232387
],
[
31.0140851,
77.3491074
],
[
31.0265734,
77.3598117
],
[
31.0029348,
77.4021828
],
[
30.971714,
77.4284974
],
[
30.9494135,
77.4284974
],
[
30.930681,
77.3972766
],
[
30.9177467,
77.410657
],
[
30.9057043,
77.413333
],
[
30.891878,
77.4231453
],
[
30.8767136,
77.4182392
],
[
30.8669014,
77.4378637
],
[
30.8695774,
77.4637323
],
[
30.8454928,
77.4793427
],
[
30.7986616,
77.4793427
],
[
30.7875113,
77.51056349999999
],
[
30.8004456,
77.5159157
],
[
30.8022297,
77.5346481
],
[
30.7973236,
77.5391083
],
[
30.7781451,
77.5310801
],
[
30.7808211,
77.5734511
],
[
30.7955395,
77.6028879
],
[
30.812934,
77.6104701
],
[
30.8107039,
77.643921
],
[
30.8035677,
77.646151
],
[
30.8062438,
77.6506111
],
[
30.7915254,
77.6715737
],
[
30.7687788,
77.6880761
],
[
30.7790371,
77.7045785
],
[
30.8084739,
77.7192969
],
[
30.8298824,
77.7442735
],
[
30.8508449,
77.7313392
],
[
30.8611703,
77.7426203
],
[
30.8811737,
77.7447195
],
[
30.8825118,
77.7545318
],
[
30.8651173,
77.7652361
],
[
30.8584271,
77.7893207
],
[
30.8722535,
77.7835225
],
[
30.893216,
77.78530659999998
],
[
30.9128405,
77.800917
],
[
30.9262209,
77.7911047
],
[
30.9222068,
77.7456116
],
[
30.9338031,
77.7465036
],
[
30.9396012,
77.7366913
],
[
30.9596717,
77.7344613
],
[
30.9766202,
77.7540858
],
[
30.9770662,
77.763898
],
[
30.9552116,
77.802255
],
[
30.9534276,
77.8169734
],
[
30.9601177,
77.81875739999998
],
[
30.9610098,
77.8044851
],
[
30.96993,
77.7964569
],
[
30.9989207,
77.8134053
],
[
31.0051649,
77.8098372
],
[
31.008287,
77.8254476
],
[
31.0158692,
77.81875739999998
],
[
31.0301415,
77.8214335
],
[
31.0622544,
77.800471
],
[
31.0609163,
77.81474329999999
],
[
31.066828,
77.8190783
],
[
31.0690927,
77.8207392
],
[
31.0742967,
77.8245556
],
[
31.0814328,
77.842842
],
[
31.1108696,
77.8513163
],
[
31.124696,
77.878523
],
[
31.1545787,
77.8874432
],
[
31.1563628,
77.9146499
],
[
31.1786633,
77.9547909
],
[
31.165283,
77.9695093
],
[
31.167067,
77.9927019
],
[
31.1550247,
78.0141104
],
[
31.1715272,
78.0163405
],
[
31.1853535,
78.0301668
],
[
31.1929357,
78.0538055
],
[
31.1907057,
78.0877023
],
[
31.2138982,
78.1193691
],
[
31.2161283,
78.1349795
],
[
31.2317387,
78.1479139
],
[
31.2317387,
78.1715525
],
[
31.2223725,
78.1876089
],
[
31.2259406,
78.2000972
],
[
31.2370908,
78.2067874
],
[
31.2348608,
78.232656
],
[
31.2714337,
78.269229
],
[
31.2660816,
78.2933136
],
[
31.2883822,
78.2982197
]
]