[OpenLayers-Users] GML Overlay

Christopher Schmidt crschmidt at metacarta.com
Wed Sep 16 17:47:31 EDT 2009


On Wed, Sep 16, 2009 at 02:15:14PM -0700, Dash wrote:
> 
> Well, I figured out the answer.  The Data Interop. Tool by ESRI outputs the
> coordinates in a lat / long format.  Well, OpenLayers and the GML file
> require the coordinates to be in a long / lat format.  What a pain in the
> butt!  Now, does anyone know how to fix that?

GML Format option: "xy: false"

So, in a Vector Layer:

 Vector("", "file.gml", {format: OpenLayers.Format.GML, formatOptions: {xy: false}});

-- Chris

> 
> 
> Dash wrote:
> > 
> > 
> > Christopher Schmidt-2 wrote:
> >> 
> >> On Tue, Sep 15, 2009 at 11:42:47AM -0700, Lugosi, Jim wrote:
> >>> I am trying to figure out how to use the GML overlay with OpenLayers.  I
> >>> have searched high and low for examples and nothing seems to help.  I am
> >>> currently trying to convert a shapefile to a GML file using ESRI's Data
> >>> Interop. Tool.  I've used both the quick export and the Spatial ETL
> >>> Tool.  Everything seems to work, but when I try to display the
> >>> information on my map nothing shows up.  There are no JavaScript errors
> >>> and the layer shows up in my LayerSwitcher control so I really can't
> >>> tell what the problem is.  Also, I've dumbed down the process by
> >>> creating a shapefile of a box so that I don't have a large number of
> >>> coordinates.  Could someone please help with my dilemma?
> >> 
> >> http://docs.openlayers.org/help/minimize.html
> >> 
> >>> Thanks...
> >>> 
> >>> James Lugosi
> >>> Clackamas County - GISP
> >>> www.clackamas.us/gis
> >>> 503-723-4829
> >>> 
> >> 
> >>> _______________________________________________
> >>> Users mailing list
> >>> Users at openlayers.org
> >>> http://openlayers.org/mailman/listinfo/users
> >> 
> >> 
> >> -- 
> >> Christopher Schmidt
> >> MetaCarta
> >> _______________________________________________
> >> Users mailing list
> >> Users at openlayers.org
> >> http://openlayers.org/mailman/listinfo/users
> >> 
> >> 
> >> 
> > 
> > 
> > Dash wrote:
> >> 
> >> I understand that you are probably trying to help me without words but a
> >> little more than just a link would help.  Believe me, I've removed lines
> >> of code and simplified everything I could.  I guess the next step would
> >> be to post the code.  Here is the init function I use when launching the
> >> page:
> >> 
> >> var map, layer, popup;
> >> var markers, feature, marker;
> >> 
> >> function init() {
> >> 	// Default map projection is ESPG:4326 -> WGS 84
> >> 	// WGS 84 Bounds: -180.0000, -90.0000, 180.0000, 90.0000
> >> 	map = new OpenLayers.Map('map');
> >> 	
> >> 	// Initiate Map Controls
> >> 	map.addControl(new OpenLayers.Control.LayerSwitcher());
> >> 	map.addControl(new OpenLayers.Control.MousePosition());
> >> 	
> >> 	// Create Google Layers
> >> 	var gmap = new OpenLayers.Layer.Google("Google Streets",{numZoomLevels:
> >> 20});
> >> 	var gphy = new OpenLayers.Layer.Google("Google Physical", {type:
> >> G_PHYSICAL_MAP});
> >>     var gsat = new OpenLayers.Layer.Google("Google Satellite",{type:
> >> G_SATELLITE_MAP, numZoomLevels: 20});
> >>     var ghyb = new OpenLayers.Layer.Google("Google Hybrid",{type:
> >> G_HYBRID_MAP, numZoomLevels: 20});
> >> 	
> >> 	// GML 
> >> 	var oc = new OpenLayers.Layer.GML("Box", "./textbox.xml");
> >> 	
> >> 	// Add layers as an array
> >> 	map.addLayers([gmap, gphy, gsat, ghyb, oc]);
> >> 	
> >> 	// Zoom to the passed in bounds
> >> 	//boundsExtent = new OpenLayers.Bounds(-180.0000, -90.0000, 180.0000,
> >> 90.0000);
> >> 	boundsExtent = new OpenLayers.Bounds(-123.562589253, 44.729986898,
> >> -121.568458954, 45.918452947);
> >> 	map.zoomToExtent(boundsExtent);
> >> }
> >> 
> >> Here is the GML file that was created:
> >> <?xml version="1.0" encoding="UTF-8"?>
> >> <gml:FeatureCollection xmlns:gml="http://www.opengis.net/gml"
> >> xmlns:xlink="http://www.w3.org/1999/xlink"
> >> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> >> xmlns:fme="http://www.safe.com/gml/fme"
> >> xsi:schemaLocation="http://www.safe.com/gml/fme textbox.xsd">
> >> <gml:boundedBy>
> >> <gml:Envelope srsName="EPSG:4326" srsDimension="2">
> >> <gml:lowerCorner>45.3117814762066 -122.640406532134</gml:lowerCorner>
> >> <gml:upperCorner>45.3820822372628 -122.536820512781</gml:upperCorner>
> >> </gml:Envelope>
> >> </gml:boundedBy>
> >> <gml:featureMember>
> >> <fme:testbox gml:id="iddfa35c96-59ff-4423-b062-668e3993b702">
> >> <fme:FID>0</fme:FID>
> >> <fme:Id>0</fme:Id>
> >> <gml:surfaceProperty>
> >> <gml:Surface srsName="EPSG:4326" srsDimension="2">
> >> <gml:patches>
> >> <gml:PolygonPatch>
> >> <gml:exterior>
> >> <gml:LinearRing>
> >> <gml:posList>45.3117814762066 -122.640406532134 45.3820822372628
> >> -122.640406532134 45.3819865899688 -122.536820512781 45.3117814762066
> >> -122.538255222191 45.3117814762066 -122.640406532134</gml:posList>
> >> </gml:LinearRing>
> >> </gml:exterior>
> >> </gml:PolygonPatch>
> >> </gml:patches>
> >> </gml:Surface>
> >> </gml:surfaceProperty>
> >> </fme:testbox>
> >> </gml:featureMember>
> >> </gml:FeatureCollection>
> >> 
> >> Is there something I am missing?  Any help would be greatly appreciated.
> >> 
> >> 
> > 
> > 
> > 
> > 
> 
> -- 
> View this message in context: http://n2.nabble.com/GML-Overlay-tp3650992p3659138.html
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users

-- 
Christopher Schmidt
MetaCarta



More information about the Users mailing list