Solved

Geoserver/Google Maps mashup overlay SLD problem

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

NAS Cloud Backup Strategies

This article explains backup scenarios when using network storage. We review the so-called “3-2-1 strategy” and summarize the methods you can use to send NAS data to the cloud

Question has a verified solution.

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

I feel like more and more people want to know how to programmatically convert addresses into geospatial locations. So in this article, I will show you how you can do it with Bing Maps. I'm going to use PowerShell, which is a nice scripting language,…
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
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…

825 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