4

I have some population and thefts data as below:

enter image description here

I am able to geocode these and build a map of county polygons in QGIS with the attributes attached.

However, my final objective is to have a web map where the user should be able to type in a zip code which returns the number of total thefts and growth of thefts for all counties within a 50 mile radius. We need the map to be accessible on a ipad as well.

what tool to use for building such a web map?

1
  • Would you have a 50 mile buffer around a zip code polygon? or a 50 miles radius from the centroid of the zip code polygon? zip codes can be very irregularly shaped. Would it be better to just use an address?
    – Tangnar
    Commented May 3, 2016 at 19:35

2 Answers 2

3

You do not necessarily need to draw a map if you are working with an entered zip code.

Turf.js which was made for working with JavaScript mapping however could be really useful.

The aggregate function could be helpful you here if you can use the counterpoints of counties. You could also use polygons, but it will be more complicated.

Simply using center points:

  • Create GeoJSONs for both your zips and county data with polygons.
  • Select point from zips with the turf.filter function.
  • Create your 50 mile radius from the point with turf.buffer
  • Use turf.aggregate to get polygons with the sums of the attributes.

A bit more complicated way if you wish to use polygons:

  • Create GeoJSONs for both your zips and county data with polygons.
  • Select zip polygon with turf.filter.
  • Create your 50 mile radius buffer with turf.buffer.
  • Create variables to hold your totals for each attribute with 0.
  • For each county use turf.intersect with your 50 mile buffer to check that it doesn't return undefined (or that it returns a polygon). If your buffer and county overlap add each of the county attributes to the totals.

If you wish to display a map you could input your filtered ZIP code point/polygon, your buffered polygon, and the aggregated/intersected polygons.

Additionally you could replace using turf.filter and your own zip GeoJSON with using a lookup service like Mapbox geocoding which will also work with addresses or town names.

1

MangoMap has that feature out of the box. Here's a map that demonstrates the tool:

http://mangomap.com/maps/51645/Query-Tool

Disclaimer: I'm a founder of Mango ;-)

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.