• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1236
  • Last Modified:

building bounding box from esri shapefile

I have ESRI shapefiles from a gov source.  I want to grab bounding box coordinates, a best fit rectangle that circumscribes the geographical region.  I need to get the lat/long min/max values (all 4) into a csv.  Found this tool http://www.obviously.com/gis/shp2text/ but cant figure out how to use it.  
0
sbauch
Asked:
sbauch
  • 9
  • 5
5 Solutions
 
TommySzalapskiCommented:
Just parse through all the x,y coordinates in the shape file (use the info here http://en.wikipedia.org/wiki/Shapefile).
Skip the100 bytes for the header and then for each of the records look at all the X and Y values and calculate the max and min.
Or is that what you need help doing? What language do you code int?
0
 
sbauchAuthor Commented:
Yeah exactly I don't code.  I built a drupal site using point and click, and I'm trying to do this to set up a geo taxonomy system without typing out all of my taxonomy terms and bounding boxes.  I also don't really understand the bounding box exactly.  Looking through the shp.xml file in a text editor I see this:

<geoBox esriExtentType="decdegrees">
                  <westBL Sync="TRUE">-74.257465</westBL>
                  <eastBL Sync="TRUE">-73.69945</eastBL>
                  <northBL Sync="TRUE">40.915808</northBL>
                  <southBL Sync="TRUE">40.495805</southBL>
                  <exTypeCode Sync="TRUE">1</exTypeCode>
            </geoBox>

but that's the only place where I see coordinates.  The shapefile I downloaded is for NYC boroughs, so my impression was that this file would have bounding box values for all 5 boroughs, whereas that looks like it might be the coordinates for a box that bounds all of NYC.
0
 
Molnar IstvánHelpDesk / ProgrammerCommented:
my idea is :
on this site is an online file converter:
http://www.gpsvisualizer.com/gpsbabel/
, you can convert the file to google earth kml file , then open the kml file in google map and modify the coordinates

hope it helps
0
Free Tool: Path Explorer

An intuitive utility to help find the CSS path to UI elements on a webpage. These paths are used frequently in a variety of front-end development and QA automation tasks.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

 
TommySzalapskiCommented:
Can you post the .shp file and the shp.xml file if they aren't super large or link to where you downloaded them would be better.
0
 
TommySzalapskiCommented:
quicksilver, that's for waypoint files and such. I don't think it will work on .shp files.
0
 
sbauchAuthor Commented:
link here:

http://www.nyc.gov/html/dcp/html/bytes/dwndistricts.shtml#bcd

I want to have a multiple level hierarchy, so I eventually need 2 csv files, one for borough bounds and one for whatever gov't label fits common neighborhood bounds best
0
 
TommySzalapskiCommented:
Ah. This tool is exactly what you need
http://www.qarah.com/shapeviewer/

Give me a minute and I'll crack out the excel formulae you need.
0
 
TommySzalapskiCommented:
Okay I got it. Here is an Excel file that will get the data for you.
Open the .shp file in shape viewer and hit File->Export->Coordinates to Excel
Paste the data from that file to the shp sheet.
Then open the .dbf file and paste the data there on the dbf sheet.
Fill the formulas down (note they are array formulas so if you edit them use ctrl+shift+enter to confirm)
I stripped most of the data off the shp sheet because it was too large to the numbers in the sheet I am posting are not correct. You need to export the file and paste the data then the numbers will be right.

By the way. If you feel this deserves the full 500 points, please increase the point value of the question. Thanks. (I win a free t-shirt if I get enough points)
shp-bounds.xls
0
 
sbauchAuthor Commented:
hmm I get this error when trying to export coordinates to excel:

Error: 5 - invalid procedure call or argument.
In: Form1.frm\Private Sub mnuExportToExcel_Click
At Line: 1

More than willing to paypal you $20 to do this for me. Is that allowed by EE's terms? I'm not a student
0
 
TommySzalapskiCommented:
Okay, here you go.
If you want the big data files let me know and I'll upload them on DropBox and post you a link.
bounds.xls
0
 
sbauchAuthor Commented:
Okay I was assuming that the resulting values would be in latitude longitude format. I guess I described what I was looking for incorrectly, but you definitely provided a very helpful answer. I have the .shp and see that you put the number of lines in what you posted, so I think I'll be able to emulate it.  Any ideas for whats next? Should I post a new question?
0
 
TommySzalapskiCommented:
That first sheet I posted has all the formulas you'll need. You should see an 'Upgrade points' button and the top of the question.
0
 
TommySzalapskiCommented:
After you get this closed hit 'Ask a related question' to ask how to convert from X,Y to lat/lon. It will notify me. I think I have an idea.
0
 
TommySzalapskiCommented:
Or just do it now.
0
 
sbauchAuthor Commented:
how do I change # of points?
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 9
  • 5
Tackle projects and never again get stuck behind a technical roadblock.
Join Now