Solved

Geoserver/Google Maps mashup overlay SLD problem

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

[Webinar] How Hackers Steal Your Credentials

Do You Know How Hackers Steal Your Credentials? Join us and Skyport Systems to learn how hackers steal your credentials and why Active Directory must be secure to stop them. Thursday, July 13, 2017 10:00 A.M. PDT

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,…
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…

729 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