Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

building bounding box from esri shapefile

Posted on 2010-11-19
15
Medium Priority
?
1,209 Views
Last Modified: 2012-05-10
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
Comment
Question by:sbauch
  • 9
  • 5
15 Comments
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 1000 total points
ID: 34175318
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
 

Author Comment

by:sbauch
ID: 34175371
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
 
LVL 13

Expert Comment

by:Molnar István
ID: 34175499
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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34175501
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
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34175530
quicksilver, that's for waypoint files and such. I don't think it will work on .shp files.
0
 

Author Comment

by:sbauch
ID: 34175583
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
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 1000 total points
ID: 34176004
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
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 1000 total points
ID: 34176243
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
 

Author Comment

by:sbauch
ID: 34176719
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
 
LVL 37

Assisted Solution

by:TommySzalapski
TommySzalapski earned 1000 total points
ID: 34176916
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
 

Accepted Solution

by:
sbauch earned 0 total points
ID: 34177277
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
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34177311
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
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34177439
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
 
LVL 37

Expert Comment

by:TommySzalapski
ID: 34177441
Or just do it now.
0
 

Author Closing Comment

by:sbauch
ID: 34203770
how do I change # of points?
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

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.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will guide you to convert a grid from a picture into Excel format using Microsoft OneNote and no other 3rd party application.
Access developers frequently have requirements to interact with Excel (import from or output to) in their applications.  You might be able to accomplish this with the TransferSpreadsheet and OutputTo methods, but in this series of articles I will di…
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

783 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question