Any free MAP API available

89 views
Skip to first unread message

Ram

unread,
Jun 3, 2020, 5:45:55 PM6/3/20
to 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

unread,
Jun 3, 2020, 11:53:35 PM6/3/20
to 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

unread,
Jun 4, 2020, 3:08:59 AM6/4/20
to 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

unread,
Jun 4, 2020, 11:25:09 AM6/4/20
to 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

unread,
Jun 4, 2020, 11:25:09 AM6/4/20
to 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

unread,
Jun 4, 2020, 11:25:09 AM6/4/20
to 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

unread,
Jun 4, 2020, 11:25:09 AM6/4/20
to 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

unread,
Jun 4, 2020, 11:25:10 AM6/4/20
to Django users

Ram

unread,
Jun 11, 2020, 1:08:46 AM6/11/20
to 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.
Reply all
Reply to author
Forward
0 new messages