Extracting Shapefile Geometry & Google Maps

Geography, and geographic data, play an indispensable role in the development and use of decision-making information. Almost all business, demographic and economic data relate to location(s) or area(s).

The Census Bureau TIGER/Line data, predominately made available for public use as shapefiles, are equally or more valuable than the Census Bureau demographic-economic data. These geographic data are the source for almost all online map services now in existence. The Census Bureau releases thousands of public use shapefiles annually that reflect changing geography — changes to political and statistical boundaries and changes to roads and earth surface geographic attributes. Use the Shp2XML software to extract shapefile geometry and output those data to XML-structured file.

Shapefile Geometry as XML File with Google Maps API
Integrate the shapefile geometry into a Google Maps API application.

Click graphic to view as dynamic Google map.

Shapefile Geometry
Shapefiles do not contain the geometry coordinates in the shapefile DBF. The geometry coordinates (e.g., latitude and longitude of vertices) are not directly viewable or extractable without specialized software. Many applications require coordinates only available in shapefiles. For example, an XML file with coordinates can be used as a polyline or marker file with Bing or Google maps. The coordinates list can be processed by wide-ranging geospatial applications.

Extracting Shapefile Embedded Geometry
Use the Shp2XML software to extract shapefile geometry and output those data to XML-structured file. Shp2XML generates an XML file (text file) that contains the coordinates of the each shape in the user selected shapefile (or a subset of shapes in the shapefile if a query is applied). Optionally save the XML file in XLS format.

Using Shp2XML — an example of exporting census tract boundaries
The Shp2XML start-up view is shown in the following graphic. The map view shows Washington, DC by Census 2010 census tracts. The view is based on the shapefile (cb_2013_11_tract_500k.shp) included with the installer,

Click graphic for larger view
User controls and legend panel are shown to the left of the map view panel. The XML file generated is shown to the right of the map view.

Using Shp2XML — an example of exporting roads/line segment geometry
The following view shows Washington, DC by ZIP Code area (ZCTA) and all roads/edges shapefiles as layers. The view uses the shapefile ZCTA shapefile (cb_2013_11_tract_500k.shp) and the EDGES shapefile (tl_2010_11_zcta510.shp) both included with the installer.

Click graphic for larger view
This view was developed using these steps:
• Use File>Open Shapefile to open the ZCTA shapefile.
• Use Add Shapefile (+ button at top of left panel) to add the EDGES shapefile.
• Modify attributes of the ZCTA layer to set as transparent/red boundary with ZIP Code as label.
• Add the query “roadflg=’Y’ and ZIPL=’20010′” (this results in only meeting roads this criteria to be exported.
• Select a field to be used as NAME (NAME) and field to be used as CODE (TLID) using list boxes.
• Click the Shp2Xml Convert button.

Installing and Using Shp2XML
Shp2XML Level 1 is available at no fee to members of the ProximityOne User Group (no fee, join now).

See more information about installing and using Shp2XML.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s