[OpenLayers-Users] Layer rendering

Carlos Pinto cmspinto at gmail.com
Wed Mar 5 09:35:50 EST 2008


Hi Andreas,

sorry to keep bothering, but when I add this line the polygons don't appear
:(

 var lookup = {
           0: {fillColor: "green", fillOpacity: 0.7, strokeColor: "green"},
           1: {fillColor: "red", fillOpacity: 0.7, strokeColor: "red"}
        }
// until here it is everything ok

// when I had this line the layer doesn't show up, I imagine he don't
recognize the property
styleMap.addUniqueValueRules("default", "type", lookup);


and I am using :  <script
src="http://www.openlayers.org/dev/lib/OpenLayers.js"></script>

so it is version 2.6




On Wed, Mar 5, 2008 at 3:06 PM, Andreas Hocevar <andreas.hocevar at gmail.com>
wrote:

> Carlos,
>
> everything below is perfect, except that you need to add:
>
> <ms:type>1</ms:type>
>
> instead of
>
> <type>1</type>
>
> And yes, you should add the {styleMap: styleMap} options hash to your
> GML layer constructor. Or, after constructing the layer, just do
>
> myLayer.styleMap = styleMap;
>
> Regards,
> Andreas.
>
> Carlos Pinto wrote:
> > Hi all,
> >
> > then, if I use OpenLayers 2.6 I can use this feature, can I ask a help
> > of how then can I link the GML with the type?
> > and how can I format the color, transparency and set border of the
> > polygon?
> >
> > can I do like this?
> > Thanks for your help, Carlos
> >
> >
> > var lookup = {
> >    0: {fillColor: "green", fillOpacity: 0.7, strokeColor: "green},
> >    1: {fillColor: "red", fillOpacity: 0.7, strokeColor: "green"},
> >
> >    2: {fillColor: "#00ffff", fillOpacity: 0.7, strokeColor: "#00ffff"}
> >
> > }
> > styleMap.addUniqueValueRules("default", "type", lookup);
> >
> > // when I had the layer how do I say to apply the rules????
> > var mylayer =   new OpenLayers.Layer.GML("GML",
> > "../KML/myPolygons.xml"); // should I add here in the end {styleMap:
> > styleMap}
> > map.addLayer(mylayer);
> >
> > So I have put the line *        <type>1</type>  * in  the GML:
> >
> >     <gml:featureMember>
> >       <ms:polygon fid="2">
> >         <gml:boundedBy>
> >             <gml:Box srsName="EPSG:4326">
> >                 <gml:coordinates>0.511919,47.088176
> > 3.002191,48.882988</gml:coordinates>
> >             </gml:Box>
> >         </gml:boundedBy>
> >         <ms:msGeometry>
> >         <gml:Polygon srsName="EPSG:4326">
> >           <gml:outerBoundaryIs>
> >             <gml:LinearRing>
> >               <gml:coordinates>7.25,54.25 7.75,54.25 7.75,54.75
> > 7.25,54.75 7.25,54.25</gml:coordinates>
> >             </gml:LinearRing>
> >           </gml:outerBoundaryIs>
> >         </gml:Polygon>
> >         </ms:msGeometry>
> >         <ms:ogc_fid>2</ms:ogc_fid>
> >         <ms:name>My box that is class1 </ms:name>
> > *        <type>1</type> *
> >         <ms:id>0</ms:id>
> >       </ms:polygon>
> >     </gml:featureMember>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20080305/758fd6c2/attachment.html


More information about the Users mailing list