Solved

Geoserver/Google Maps mashup overlay SLD problem

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

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

The task A number given should be formatted for easy reading by separating digits into triads. Format must be made inline via JavaScript, i.e., frameworks / functions are not welcome. So let’s take a number like this “12345678.91¿ and format i…
Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
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…

759 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