4
$\begingroup$

I have large GeoJson data files that I would like to import (i.e. buildings in a city, see image below for data structure) and then "cut out" only the buildings that are within approx. 100 GeoDisks (each of a 300m radius).

Importing the data takes a very long time, so I would like to save as much time by directly "filtering" out the specific buildings at the start - I would like to be able to run my other calculations a little more quickly.

At the moment I have filtered out the buildings by getting the centerpoint of each building first; and then using either RegionMember[] or GeoWithinQ[], but both calculations are very slow. The first using pure geometry, and the second using GeoData.

Is there a way to speed up GeoJson Data calculations ? This would be a great help! I am analysing the different types of buildings that are in a close radius to schools for a college project; to see "what schools are made of", and to then "guess" where news schools could be built.

Thanks a bunch !

the structure of the GeoJson Building Data

$\endgroup$
  • 1
    $\begingroup$ Hi Naomi, welcome to the Mathematica Stack Exchange. I'm quite experienced with GIS and with OpenStreetMaps data and I have to say, I'd highly recommend spinning up a local PostGIS DB and using osm2pgsql, and then query via SQL, rather than using any other data format. You might save yourself a lot of headaches :) $\endgroup$ – Carl Lange Jan 27 at 21:57
  • $\begingroup$ How are you doing the RegionMember calculation? Things can generally be done much faster if you first calculate a single RegionMemberFunction and then apply that to your data. $\endgroup$ – b3m2a1 Jan 27 at 22:22
  • 1
    $\begingroup$ Thanks for your quick answers! @b3m2a1 I was using a simple RegionMember like so: <Flatten@Position[ParallelMap[RegionMember[Polygon[findcoordinates[schoolMapDisk,-1]], #]&,buildingCenters],True]> I have tried RegionMemberFunction with a smaller data set; and it is already much faster! $\endgroup$ – Naomi Jan 28 at 10:15
  • $\begingroup$ @Carl I will try using the RegionMemberFunction first; as I'm not sure how to go about using PostGIS DB; but if it fails I will try this. Thanks a lot for the pointer! $\endgroup$ – Naomi Jan 28 at 10:15

Your Answer

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

Browse other questions tagged or ask your own question.