2

I asked this on stackoverflow but did not get a really clear answer. I am not really familiar with GIS systems in python. I am looking for a library to do the following:

Lets say I have a pandas data frame with one column of street addresses and another of labeled categorical or numerical data. Something like the following for San Francisco:

df=pd.DataFrame({'Location': ['1 Dr Carlton B Goodlett Place','1390 Market Street','1100 Fillmore St' ],
                 'Type': ['G', 'G','C']})

And I want to plot them on a map of San Francisco with the 'Type' column being in red for the data in 'G' and blue for 'C'. How would I a simple plot like this? How would I also include streets on the map? Can an simple example be provided?

I found a library called Geopy to change the data to longitude & latitude if it helps to convert the data. Also read that matplotlib can do this with basemap but it is for areas larger than cities.

Is there a quick way I can do this? Would I have to use ARCGIS?

5
  • 1
    I think you need to do a little more to clearly define your expected outcome so someone can help you. The process of converting an address to a spatial location (latitude/longitude) is called georeferencing and there are lots of resources on that and lots of help available if you want. What you need to clarify is what do you want to do with the resulting XY point locations. Are you wanting an interactive web-map, are you wanting a static image, what roads do you want to show (do you trust web maps like Google maps)? Does it have to be desktop & python based? Available GIS software or data?
    – John
    Commented Feb 24, 2014 at 23:16
  • @user2856159 Just a simple plot the points so I get a map with color dots representing the locations. That is it.
    – ccsv
    Commented Feb 25, 2014 at 5:31
  • Does it have to be via python though? What I'm getting at is, if you've got a CSV file for example (could be written out via python), you could upload the CSV to a wide variety of websites that could do exactly what you are asking for and they'd even geocode those addresses into lat/long for you. That would probably be a lot quicker and easier to use an existing system like that than building your own. If you don't want web based though, there are also plenty of options, but again, you're going to have to be more specific. Your question's a LOT broader than you realize...
    – John
    Commented Feb 25, 2014 at 6:38
  • @user2856159 I am trying to do it on only python if possible. I just need a visual plot with color dots to see the colors on the map to determine if patterns can be visually inspected.
    – ccsv
    Commented Feb 25, 2014 at 7:23
  • @ccsv, plotting the points can be done in many ways. You do not have to use ArcGIS, but if you have that resource available to you, then use it. Also, if you have ArcGIS, the north american locator that by default is in the software does a decent job at matching addresses. It also has a very intuitive geocoding interface. Sorry, I'm a stickler for this, but it's NOT georeferencing, it's geocoding. gis.stackexchange.com/questions/28593/….
    – evv_gis
    Commented Feb 25, 2014 at 15:33

1 Answer 1

2

So your data is essentially adresses? And you've found a library to geocode these addresses (to get lat/lons?)

Have you looked at Mapnik? It's a python lib for generating static maps. (for roads I guess you could use some openStreetMap data.

(and, when it comes to GIS tasks in Python I would recommend the book "Python Geospatial Development")

1
  • 1
    +1 pandas + geopy + mapnik + OSM - sounds fun, actually! Commented Feb 25, 2014 at 14:50

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.