Any free MAP API available

89 lượt xem
Chuyển tới thư đầu tiên chưa đọc

Ram

chưa đọc,
17:45:55 3 thg 6, 20203/6/20
đến django...@googlegroups.com
Hi,

We need to add location map based on the zip code in our DJango web application. Is there any free API available out there? if you have used it already could you suggest one?

Thanks,
~Ram

meera gangani

chưa đọc,
23:53:35 3 thg 6, 20203/6/20
đến django...@googlegroups.com
you can use Geo-Django Library available in django


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CA%2BOi5F02G9gW64FAPfKYHjEGf28hp34ePmg%3Dd%2BtVtHNSEs%2BqQg%40mail.gmail.com.

Vishesh Mangla

chưa đọc,
03:08:59 4 thg 6, 20204/6/20
đến django...@googlegroups.com

There’s map-box too if you w’d like to use it.  https://www.mapbox.com/

 

Sent from Mail for Windows 10

RANGA BHARATH JINKA

chưa đọc,
11:25:09 4 thg 6, 20204/6/20
đến Django users
Hi, You can use folium module in python to achieve this. Link to module.


Hope this helps. All the best.

RANGA BHARATH JINKA

chưa đọc,
11:25:09 4 thg 6, 20204/6/20
đến Django users
import pgeocode
import folium


'''
Provide a Country code and postal code.
It will generate a map in a html file based on these details.
Used pgeocode and folium packages.
'''

def zipcode_to_map(country_code, postal_code):
country_code = pgeocode.Nominatim(country_code)

zip_code = country_code.query_postal_code(postal_code)

postal_code = zip_code['postal_code']
multiple_zip_codes = country_code.query_postal_code(["560034", "560083"])

m = folium.Map(location=[zip_code['latitude'], zip_code['longitude']], zoom_start=9,
                   detect_retina=True, control_scale=False)

m.save(f'{postal_code}-map.html')

zipcode_to_map('in','515411')

I wrote this function.You can use this function to generate map using a zipcode and countrycode. Hope it will be useful for you.

On Thursday, June 4, 2020 at 3:15:55 AM UTC+5:30, Ram wrote:

RANGA BHARATH JINKA

chưa đọc,
11:25:09 4 thg 6, 20204/6/20
đến Django users
Hi, You can convert zipcode to latitude and longitude using this module. And use those in your map using folium.



On Thursday, June 4, 2020 at 3:15:55 AM UTC+5:30, Ram wrote:

RANGA BHARATH JINKA

chưa đọc,
11:25:09 4 thg 6, 20204/6/20
đến Django users
Hi, I created this python module. It will convert zipcode to a html map. You can use this. I will link the example usage github link.


https://pypi.org/project/zipcode-to-map/


On Thursday, June 4, 2020 at 3:15:55 AM UTC+5:30, Ram wrote:

RANGA BHARATH JINKA

chưa đọc,
11:25:10 4 thg 6, 20204/6/20
đến Django users

Ram

chưa đọc,
01:08:46 11 thg 6, 202011/6/20
đến django...@googlegroups.com
hello Ranga,

Thank you very much posting very useful direction and all the respective pointers. I really appreciate it.

This is what we tried so far, but we are seeing an error from our execution. Could you please let us know what we are missing?
import pgeocode
import folium

def zipcode_to_map(country_code, postal_code):

country_code = pgeocode.Nominatim(country_code)

zip_code = country_code.query_postal_code(postal_code)

postal_code = zip_code['postal_code']

multiple_zip_codes = country_code.query_postal_code(["560034", "560083"])

m = folium.Map(location=[zip_code['latitude'], zip_code['longitude']], zoom_start=9, detect_retina=True, control_scale=False)
m.save(f'{postal_code}-map.html') print(m) zipcode_to_map('in','515411')

Result is here >>

python sam.py
<folium.folium.Map object at 0x0000020675490E48>

Thanks,
~Ram


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users...@googlegroups.com.
Trả lời tất cả
Trả lời tác giả
Chuyển tiếp
0 tin nhắn mới