3

I am looking for a good parser for the latest GML (Geographic Markup Language) version in preferably: C++/Java/Ruby/...

I am especially interested in reading the geometry of individual features. Does anybody have recommendations?

4 Answers 4

2

Have you looked at OGR? It's part of GDAL which is written in C++, with bindings for C and Python. There may be some other unofficial bindings out there too. It supports many different formats, including GML.

1

GeoTools provides modules that will read GML 2 and 3 into a simple feature model.

1

first of all, no matter which language you use, QGis can read and write from/to any of these formats and convert freely between them, even if you're going from projected to geographic, geographic to projected, geographic-a to geographic-b or projected-a to projected-b. It doesn't matter. QGis runs on top of grass and so has a lot of power.

shp
mif
tab
ddf
000
dgn
vrl
bna
csv
**gml**
gpx
kml
geojson
itf
xml
gmt
sqlite
db
dat
e00
dxf
gxt

So if I were you I wouldn't feel constrained by geo-formats. I'd go with the library and system you're most comfortable with to the extent that you're not taking on any technical debt by doing so.

If you're going to go the ruby route, my best experience has been using the rgeo gem in conjunction with two of its extensions rgeo-shapefile & rgeo-geojson to work with geofiles. RGeo is a pleasure to work with.

So here's how its worked for me so far as far as formats.

FOR IMPORTING

  • *.shp
  • *.geojson

FOR EXPORTING

  • *.geojson
  • *.kml

So converting that gml to geojson is probably your best route for ruby gis.

RGeo runs on top of Proj4 and other libraries. Its the whole reason to do the thing in ruby. 'works directly with ActiveRecord & PostGIS if you're into that sort of thing. PostGIS returns a database record and RGeo wraps it for you with some pretty fancy capabilities. Check out Daniel Azuma's (Google employee, creator of RGeo) rubyconf talk here for an excellent introduction to the GIS/Ruby http://www.youtube.com/watch?v=QI0e2jkUbkk

also check out his blog posts mentioning rgeo-- http://blog.daniel-azuma.com/?s=rgeo&submit=Search

1

Another alternative option is the Snowflake Software GML API for Java

Text copied from the website....

This component supports over 20+ geometry, segment and surface patch types including: GM_Envelope, GM_Point, GM_Curve, GM_OrientableCurve, GM_LineString, GM_Ring, GM_Surface, GM_Polygon, GM_CompositeCurve, GM_Aggregate, GM_MultiPoint, GM_MultiCurve, GM_MultiSurface, GM_Arc, GM_ArcString, GM_Circle, GM_ArcByCentrePoint, GM_CircleByCenterPoint, GM_Geodesic, GM_GeodesicString, GM_OffsetCurve, GM_Triangle, GM_Rectangle

Disclosure: I work for Snowflake

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.