?
Solved

Geoserver/Google Maps mashup overlay SLD problem

Posted on 2013-12-10
2
Medium Priority
?
972 Views
Last Modified: 2013-12-11
I created a geologic map mashup with Google maps, GeoServer, and polyclusters.....
http://www.geology.ar.gov/geology/strat_geomap.htm

I'm attempting a different approach (updating the GeoServer layer style) but can't get anything to work...
http://www.geology.ar.gov/geology/strat_geomap_test.htm
 I'm using one layer in our GeoServer, AGS:GEOLOGY_500K, which has a default style.  When I try to override the style like this it doesn't work....
return GEOSERVERBASE + "/geoserver/wms?" + wmsparams.join("&") + "&layers=" + Geo500K + "&bbox=" + lUL_Longitude + "," + lUL_Latitude + "," + lLR_Longitude + "," + lLR_Latitude + "&sld=" + GEOSERVERBASE + "/geoserver/styles/default_polygon.sld";

Open in new window


When I try to clear the GeoServer layer like this it doesn't work...
map.overlayMapTypes.setAt(overlayMaps[a],null);
or
            map.overlayMapTypes.removeAt(0);

Go to
http://www.geology.ar.gov/geology/strat_geomap_test.htm
and select Mississippi Embayment and Gulf Coastal Plain from the Regions, then select Channel Meander from the Formations.  The style of the Geoserver layer should update with a black outline around the Channel Meander formation, but it doesn't work.
I'd like to change the style each time a formation is selected.   Am I going to have to do this each if statement when a formation is selected  .....
// CHANNEL MEANDER
	if (fmLbl == 'qcm') {	
		
		map.setCenter(new google.maps.LatLng(34.75, -92.202));
	    map.setZoom(7);
overlayMaps =[
    {
        
        getTileUrl: function(coord, zoom)
        {
            var lULP = new google.maps.Point(coord.x*256,(coord.y+1)*256);
            var lLRP = new google.maps.Point((coord.x+1)*256,coord.y*256);

            var projectionMap = new MercatorProjection();

            var lULg = projectionMap.fromDivPixelToSphericalMercator(lULP, zoom);
            var lLRg  = projectionMap.fromDivPixelToSphericalMercator(lLRP, zoom);

            var lUL_Latitude = lULg.y;
            var lUL_Longitude = lULg.x;
            var lLR_Latitude = lLRg.y;
            var lLR_Longitude = lLRg.x;

            if (lLR_Longitude < lUL_Longitude){
              lLR_Longitude = Math.abs(lLR_Longitude);
            }
            return GEOSERVERBASE + "/geoserver/wms?" + wmsparams.join("&") + "&layers=" + Geo500K + "&bbox=" + lUL_Longitude + "," + lUL_Latitude + "," + lLR_Longitude + "," + lLR_Latitude + "&sld=" + GEOSERVERBASE + "/geoserver/styles/qcm.sld";			

        },
        tileSize: new google.maps.Size(256, 256),
        isPng: true,
        maxZoom: 15,
        minZoom: 4,
        alt: 'Geology 500K'
    }
    ];

Open in new window

0
Comment
Question by:Nate_LR
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
2 Comments
 

Accepted Solution

by:
Nate_LR earned 0 total points
ID: 39712411
I believe there is a bug when using the sld parameter in the GeoServer GetMap request.  So I've registered a couple styles in my GeoServer and tried using the styles parameter.  This will do the job....
return GEOSERVERBASE + "/geoserver/wms?" + wmsparams.join("&") + "&layers=" + Geo500K + "&bbox=" + lUL_Longitude + "," + lUL_Latitude + "," + lLR_Longitude + "," + lLR_Latitude + "&styles=qcm_Geo500K";

However, I cannot get the previous overlay to clear out with
map.overlayMapTypes.setAt(overlayMaps[y],null);
or
            map.overlayMapTypes.removeAt(0);

If you go to...
 http://www.geology.ar.gov/geology/strat_geomap_test.htm

Select Mississppi Embayment and Gulf Coastal Plain from Regions.  Then select Channel Meander from Formations.  Then select Stream Overbank from Formations and you'll see the problem.
0
 

Assisted Solution

by:Nate_LR
Nate_LR earned 0 total points
ID: 39712614
For some you have to use a placeholder like this...
 map.overlayMapTypes.push(null);

then you do this....
map.overlayMapTypes.setAt(1,overlayMap);

then this will work....
map.overlayMapTypes.removeAt(1);
0

Featured Post

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This article discusses how to implement server side field validation and display customized error messages to the client.
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…
Suggested Courses

777 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question