[OpenLayers-Users] General question and GML question

Eric Lemoine eric.c2c at gmail.com
Mon Dec 8 02:01:00 EST 2008


Hi Ken

You're saying you reprojected the data to spherical mercator, but
there still is a ref to an EPSG:2153 projection object in your GML
layer's options. That doesn't look correct.

Cheers,

Eric

2008/12/7, Ken Sanderson <ken at rockies.ca>:
> Just thought I would post a quick update. I have been beating my head
> against the problem for a few days and tried most everything I could
> think of including the steps outlined below to reproject the vector
> data. I tried KML as well and though it would display fine in Google
> Earth, it wouldnt display at all in OpenLayers.
>
> Eventually I converted the data in ArcGIS to Web Mercator, then used
> gvSIG to export the GML and that worked perfect. So clearly it was a
> projection issue, but I am not sure why the reproject did not work as it
> seems fairly straight forward to implement. Is there anything I am doing
> wrong here:
>
> // create Google Mercator layers
> var gphy = new OpenLayers.Layer.Google( "Google Physical", {type:
> G_PHYSICAL_MAP,'sphericalMercator': true});
> var gmap = new OpenLayers.Layer.Google( "Google Streets",
> {'sphericalMercator': true});
> var gsat = new OpenLayers.Layer.Google( "Google Sattelite", {type:
> G_SATELLITE_MAP, 'sphericalMercator': true});
> var ghyb = new OpenLayers.Layer.Google( "Google Hybrid", {type:
> G_HYBRID_MAP, 'sphericalMercator': true});
>
> map.addLayers([gphy, gmap, gsat, ghyb]);
>
> var partners = new OpenLayers.Layer.GML("Partner Boundaries",
> "data/member_gvsig.gml", {projection: new
> OpenLayers.Projection("EPSG:2153")});
>
> map.addLayer(partners);
>
>
> Chris I tried to send you my GML files on Friday, was having email
> issues so not sure that you go them or not?
>
> Thanks for your help,
>
> Ken
>
>
>
>
> Christopher Schmidt wrote:
>> On Fri, Dec 05, 2008 at 11:42:30AM -0400, Ken Sanderson wrote:
>>> Hi everyone, this is about my third time giving OpenLayers a try and
>>> this time I thought I would bite the bullet and ask some questions
>>> instead of just going back to my mapserver setup.
>>>
>>> First a general best approach question. What I want to do is use google
>>> data and put a simple polygon boundary on top. That boundary is
>>> currently in a shape file. My thinking was to convert the shp file to
>>> gml and just add it as a layer. I have since read that this maybe
>>> tricker then I thought as google data is in a mercator projection that
>>> does not have an EPSG code.
>>
>> OpenLayers has a built in ability to convert between EPSG:4326 (lat/lon)
>> and Google's Mercator projection: see
>> http://docs.openlayers.org/spherical_mercator/#reprojecting-vector-data
>> for more information on how to use it.
>>
>>> Second more specific to the use of GML layers. I converted my shp file
>>> to GML using gvSIG and in another attempt shp2gml from spatial order. I
>>> cannot get my GML file to be viewable. Thinking it might be a projection
>>> issue I thought I would just display my GML file on its own, to avoid
>>> any conflicting projections, but that hasnt worked either. Using the
>>> gml-layer.html example I tried to work backwards and put my GML file in
>>> there, no luck.
>>
>> Can you share the GML file you generated? It's possible this is a
>> version problem, or some other parsing error: without seeing the GML
>> file (or a sample file that fails) it's hard to know for sure.
>>
>> Regards,
>
> --
> This message has been scanned for viruses and
> dangerous content by MailScanner, and is
> believed to be clean.
>
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
>



More information about the Users mailing list