[OpenLayers-Users] General question and GML question

Ken Sanderson ken at rockies.ca
Mon Dec 8 11:22:23 EST 2008


No I did not, I just assumed it was hooked into OpenLayers already and 
you know how assumptions go! Thanks, knew it was going to be something 
stupid I did or in this case didnt do.

Another question in regards to GML display. My OL map is working great 
in firefox, however in IE7 it does not display the GML layer, everything 
else works fine. Any ideas why this is?

My code thus far:

// make map available for easy debugging
var map;

// avoid pink tiles
OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
OpenLayers.Util.onImageLoadErrorColor = "transparent";

function init(){
   var options = {projection: "EPSG:900913", units: "m", maxResolution: 
152.87405654296876, maxExtent: new 
OpenLayers.Bounds(-12880934.7752,6478707.8018,-12605930.3632,6767204.4938)};
   map = new OpenLayers.Map('map', options);

   var styleMap = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults(
         {fillColor: "orange", fillOpacity: .1, strokeColor: "orange"},
         OpenLayers.Feature.Vector.style["default"]));

   // 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]);
   map.addControl(new OpenLayers.Control.LayerSwitcher({'activeColor': 
"#610303"}));

   var partners = new OpenLayers.Layer.GML("Partner Boundaries", 
"data/members_merc.gml", {styleMap: styleMap});
   map.addLayer(partners);

   map.zoomToMaxExtent();

}

Thanks,

Ken

Christopher Schmidt wrote:
> On Mon, Dec 08, 2008 at 10:05:35AM -0400, Ken Sanderson wrote:
>> Sorry for the confusion. This is the 'broken' version as I was hoping 
>> someone might see what I was doing wrong to make it so this wouldnt 
>> work. My working version does not have that 2153 reference.
> 
> Does your application include proj4js, and definitions for the 2153
> projection?
> 
>> Ken
>>
>>
>>
>> Eric Lemoine wrote:
>>> 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
>>>>
>> -- 
>> 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
> 

-- 
This message has been scanned for viruses and
dangerous content by MailScanner, and is
believed to be clean.




More information about the Users mailing list