0

I want to find the square bounding boxes that cover a country, of different sizes.

First off, I know that they won't really be square, but just going by the numbers they can be said to be.

The main challenge I have is I don't know where get the data of the points of the countries and/or the borders. After that I think I can calculate the boxes by iterating over them.

Let's say I want do this for the continental US and with boxes of size 50 (lat, lon), then I can easily do this manually. The first box (starting from NW) would be [[50, -150], [0, -100]], and the second is [[50, -150], [0, -100]], and I'm done.

Now let's say the size is 25, and now the first box is [[50, -125], [25, -100]]. I will end up with more boxes but a more defined area and overall smaller. I guess another term could be "search grid" calculations.

Is there any publicly available datasets or APIs that I can use to determine if a bounding box or a point belongs to a country?

  • 3
    Yes, this is GIS 'bread and butter', it's just a simple spatial query. Do you have any software in mind? Do you want to do this interactively or are you writing a script or program? – Michael Stimson Jul 12 '18 at 5:28
  • What you're describing is more commonly referred to as spatial indexing. Here's how its done with SQL Server. – Kirk Kuykendall Jul 12 '18 at 14:24
  • I would only need to do this once per country, then store the boxes in a database. Not interactive. – Sarke Jul 13 '18 at 1:18
0

One way you might be able to do it is if you have a shapefile of that country. You could use a tool like Clip in ArcMap.

Open the tool and try to clip any raster with it. When you assign the shapefile, extent values automatically populate the fields in the tool window. You can make a note of it and close the tool without running it.

  • Are there any open source or free sources that can provide this shape file information? – Sarke Jul 13 '18 at 1:22
  • 1
    Yep, for sure. Start here: census.gov/geo/maps-data/data/tiger-cart-boundary.html. You can download the US or individual states. If you are looking for another country, google "world shapefile", etc. – Rachel Rotz Jul 17 '18 at 2:37

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.