I have an ESRI Shapefile with multiple subregions. I need the lat/long points that make up those regions and their unique identifier so I can convert them into a custom format for use in AnyLogic. (AnyLogic can read Shapefiles using OpenMap, but I cannot access the lat/long points using the API.) How would I get them? Is there a command line tool to do this? How would I do it myself, if need be?
Generally you can use OGR2OGR to do something with your shapes.
May be you could find this helpful.
Related
I need to go about building 2,800 polygons (using MVC Array) for a google maps (v3) and displaying some attribute information. There seems to me that there are two ways to do this:
1) just load an array of 15,000+ points from a MySQL db file. I am planning on generating these points using a vertices command in a GIS platform. All vertice points that are vertices of a common building polygon will share the same identifier (i.e. building id). I will generate the lat/longs of each of these points in the WGS84 coordinate system (i.e. EPSG 4326) http://spatialreference.org/ref/epsg/4326.
OR
2) Parse a MySQL Geometry file (which comes in the Blob format) into a readable set of coordinates for google maps to read. I am still fuzzy on how to do this....(especially dealing with Blob)...but I suspect I need to load the file in the WGS84 coordinate system and start from there. Also, need to load the dbf file (in order to call the attributes) and correspond this with the building id.
My questions are:
Of option 1 & 2 what would be the best course of action to take for a low-experience programmer and the volume of data (i.e. 2000 polygons, which breakdown into 15000 points)?
IS WGS 84 (EPSG 4326) what I need my polygon coordinates to be in??? I've found a lot of confusion on this (some sites suggest WGS 84 - Mercator, EPSG 3857). This is a rather critical processing step to know...so I really hope for some guidance if possible.
Thanks!!!
I'm trying to develop a application that uses informations from google/bing maps, but I need the vertice data to recreate roads and I can't use images since I can't get road names and height info.
I need vertices/nodes of streets (with latitude,longitude,altitude, street name ) and no visual data.
Thanks.
Open Street Map is definitely the way to go for this - extracting vertex information from Bing/Google is both technically difficult, and a breach of the Terms of Use. OSM data is better quality in many cases and, more to the point, free to use under a CC-BY-SA licence.
You'll also probably need a spatial database in which to store the information. I've written a couple of articles about loading OSM data into SQL Server which you might find helpful. e.g.:
http://alastaira.wordpress.com/2011/04/15/loading-open-street-map-data-in-sql-server-part-ii-ways/
I have a few hundred GPS coords stored in a mysql DB. They are of major cities across the globe. I need to put these points on a map, with a 100km semi-transparent radius circle around each point.
How does one go about doing that?
Try KML. It uses tags, in a fashion similar to XML, to create objects that can be imported into Google Earth. You may want to create <Geometry> objects consisting of a <Point> and a <LineString> for each of your locations. Since it is not possible to draw a circle directly, you will have to define many points that are equidistant from the city to create something that looks like a circle.
Use whatever glue language you prefer for parsing the coordinate data from your DB and generating a KML file. It should be fairly straightforward once you've figured out how to do it with one data point.
I have an interesting problem where I want to see if a pair of Latitude/Longitude points are within the region of 4 other specified ones. An application of this is specifying 4 intersections and seeing if the address is within that region. With the Google Maps Geocoding API (http://code.google.com/apis/maps/documentation/geocoding/) it's easy to convert the intersections into the long/lat and if the area is a perfect rectangle it's easy.... but what if the street is curvey? Does something like this already exist?
It sounds like you are looking for a point-in-polygon routine. http://en.wikipedia.org/wiki/Point_in_polygon
There are many implementations of point-in-polygon; if you are using PostGIS for your a database backend, use the ST_Intersects. There is already a question/answer on stackoverflow with code for a point-in-polygon function, see Point in Polygon Algorithm
How do I take shapefiles and extract lat/lng coords so I can plot polygons on Google Maps?
http://www2.census.gov/cgi-bin/shapefiles/national-files
I asked this question here:
http://groups.google.com/group/Google-Maps-API/browse_thread/thread/18763b4b0cb996c7
and they told me WHAT to do, but not HOW to do it =P
Thx!
It depends on how you need to accomplish this. If you just need a few shapes, you can look up the coordinates in those files yourself. You can use those coordinates to create a GPolygon in Google Maps.
If you need lots of shapes - you'll need to do it programmatically. I would suggest using your favorite language to parse the XML file and retrieve the coordinates for each shape.
I had a similar problem last year when I was developing a screensaver to render presidential polling data. I didn't really want to invest the time to parse the Shapefiles data on the census site (The spec is here if you missed it).
Not sure if I actually saved any time here, but I ended writing a python app to render the 50 states onscreen, trace the edges and then store the data in a simple text format. Not sure if my data is high res enough for your application, but you can grab the data I generated here:
http://www.cannonade.net/pnt.zip
N.B. The data I generate are not latitude/longitudes, but with some scaling you should be able to translate them.
Good luck.
I had better luck using the ARC files at http://www.census.gov/geo/www/cob/index.html
I can't find the webpage right now, but I did find one that had actual code. Google something like "arc to kml" and go from there.