Solved

Geoserver/Google Maps mashup overlay SLD problem

Posted on 2013-12-10
2
866 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
  • 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Avoid defining the variables in the global scope; trying to define them in a local function scope. Because:   • Look-up is performed every time a variable is accessed.   • Variables are resolved backwards from most specific to least specific scope…
This article will give core knowledge of JavaScript and will head in to your first JavaScript program. I am Durvesh Naik and I am here to deal with this series of JavaScript. I will teach you JavaScript in part wise , as its quite boring to read big…
This tutorial demonstrates how to identify and create boundary or building outlines in Google Maps. In this example, I outline the boundaries of an enclosed skatepark within a community park.  Login to your Google Account, then  Google for "Google M…
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…

911 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

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now