I have an Excel file that contains polygon coordinates for different areas. The spreadsheet has three columns: latitude, longitude and area name. Each coordinate makes of a part of the boundary of a polygonal area.

A sample of the data can be viewed here on google docs.

A subset of that sample is below:

Latitude   Longitude   AreaName
43.76559098    -79.41218646    Area1
43.76551428    -79.41216573    Area1
43.76516783    -79.41207212    Area1
43.76476698    -79.41196381    Area1
43.73581704    -79.4559399     Area2
43.73327829    -79.45336613    Area2
43.73359084    -79.45189026    Area2
43.73388256    -79.45052026    Area2

How can I turn this data into a shapefile that can be imported into CartoDB as a set of polygons?

Note: CartoDB accepts shapefiles that are in the following format.

  • Turning it into a point shapefile is fairly simple, I'm not sure about polygon shapefile as I haven't tried doing that myself. You will need to separate the cordinates into 2 columns than add them in ArcMap using the Add XY data option. Take a look at this Mar 25 '16 at 4:53
  • @zgall1 what are these 'areas' you're referencing? Do they exist in a shapefile that you know of? You're only showing X,Y locations, not polygons, but you are calling them area1, area2, etc... where did those names come from? Mar 25 '16 at 19:28
  • @mapBaker An area is a school catchment area. Here is an example of one such catchment area - tdsb.on.ca/Findyour/School/ByMap.aspx?focusOnSchool=4312. If you view the source code for the page, you can find the coordinates that make up the entire polygon. I am not sure if a single shapefile exists that contains the entire set of catchment area bonundaries but even if it did, the organization that manages that site (the TDSB) would not release it publicly.
    – zgall1
    Mar 25 '16 at 19:51
  • @zgall1 I think that explains your problem! We (Denver Public Schools) make our school district boundaries public - you should reach out to TDSB and see if they can do the same, because without those polygons, you're not going to have any luck... Mar 25 '16 at 19:53
  • @mapBaker I already know that the TDSB will not release shapefile for their catchment areas. My intent was to scrape the polygonal coordinates from the website I linked to.
    – zgall1
    Mar 26 '16 at 4:58

Your scraped data will look like this:

enter image description here

What you have to do, and what your question should ask, is how to take grouped points and convert them into polygons for each Area in your data

See an answer like this: Converting point sets to polygon boundaries? but I don't know if it will 'rebuild' the polygons that were used to create the sets of LAT/LON

  • Thank you for the explanation. It seems I have dramatically underestimated the complexity of what I am looking to do. Given the specific map, e.g., tdsb.on.ca/Findyour/School/ByMap.aspx?focusOnSchool=5306, is there any way to extract any additional information that would be beneficial in determining the exact shape of the polygon?
    – zgall1
    Mar 26 '16 at 20:14
  • A follow up question - if I know that point A connects to point B connects to points C ... connects to point Z, does that in any way simplify the process of reconstructing the polygon from a set of points?
    – zgall1
    Mar 26 '16 at 20:16
  • In CartoDB, I would expect ST_ConvexHull (geom) to work, but it doesn't - so my last recommendation would be how to convert points to polygons in CartoDB... otherwise, ST_ConvexHull should do this in PostGIS (what CartoDB is based on...) - lastly, there may be some bigger object behind the scenes of that website with the complete polygons - like a GeoJSON file, KML, or a web service... might want to check for a complete polygon file on their server... Mar 26 '16 at 20:31
  • I am far from an expert on this but I've done a bit more thinking about your answer and I'm not sure if this is as complex as you have made it out to be. The set of points for a given polygon creates a full polygon as the first and last coordinate for a given polygon are the same. Isn't there a tool or function that says connect point A to point B to point C to point D to point A? Something like this - developers.google.com/maps/documentation/javascript/examples/…
    – zgall1
    Mar 26 '16 at 20:37
  • Only one way to find out... Mar 26 '16 at 21:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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