[OpenLayers-Users] vector doesn't display

Gery . gamejihou at hotmail.com
Fri Dec 14 02:19:44 PST 2012


thanks for the answer Matt, OpenGSC and Diego, I'll check the links and see what is going on there

Regards,


__________________________________________________________________________________________
Piensa en el medio ambiente - mantenlo en la pantalla. NO lo imprimas si NO es necesario.
Think green - keep it on the screen. Do NOT print if it is NOT necessary.
Denken Sie an die Umwelt - bewahren Sie es auf dem Bildschirm. Drucken Sie NICHT, wenn es NICHT notwendig ist.


Date: Wed, 12 Dec 2012 12:11:01 -0600
From: mpriour at kestrelcomputer.com
To: openlayers-users at lists.osgeo.org
Subject: Re: [OpenLayers-Users] vector doesn't display


  
    
  
  
    You have to actually load the GeoJSON features into the layer.

    

    First, look at the following examples:

    

    http://openlayers.org/dev/examples/geojson-reprojected.html

    http://openlayers.org/dev/examples/cartodb-geojson.html

    

    They both use a Fixed strategy which is the best one if you want to
    load your data once and have it in a static file or known URL.

    

    You would add your style definition to the vector layer definition
    they present in these examples and then you would have a layer with
    features to be symbolized.

    

    Matt Priour

    Kestrel Computer Consulting

    

    

    On 12/12/2012 6:21 AM, Gery . wrote:

    
    
      
        
        Hello,

            

            I have some features in GeoJSON format I want to display, so
            I did this:

            

            [code]

                  var vectorLayer = null;

            

                    var vectorStyle =

                    {

                        graphicName: 'square',

                        strokeColor: '#222',

                        fillColor: '#222'

                    };

            

                    var styleDefault = OpenLayers.Util.applyDefaults(

                        vectorStyle,

                        OpenLayers.Feature.Vector.style['default']

                    );

            

                    vectorLayer = new OpenLayers.Layer.Vector('search',

                    {

                        styleMap: new OpenLayers.StyleMap(

                        {

                            'default': styleDefault

                        }

                        ),

                        displayInLayerSwitcher: true

                    }

                    );

          [/code]

            

            but they don't appear in the map, my question is if this is
            enough to get the features displayed or do I need something
            else there? if this is enough, I should think that this
            problem is about how the features are being read by OL. In
            fact, this doesn't work either:

            

            var ll = new OpenLayers.LonLat(feature.geometry.x,
            feature.geometry.y);

            mapPanel.map.setCenter(ll);

            

            I get: 

            

          
          feature is not defined
          
          
            
              
                
                
                    var ll = new OpenLayers.LonLat(feature.geometry.x, feature.geometry.y);
                  
              
            
          
          

            why should this happen? thanks in advance
          

          

          

__________________________________________________________________________________________

            Piensa en el medio ambiente -
              mantenlo en la pantalla. NO lo imprimas si NO es
              necesario.

          Think green - keep it on the screen. Do NOT
            print if it is NOT necessary.

          Denken Sie an die Umwelt - bewahren
                Sie es auf dem Bildschirm.
              Drucken Sie NICHT, wenn
              es NICHT notwendig ist.

        
      
      

      
      

      _______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users

    
    

  


_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users 		 	   		  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/openlayers-users/attachments/20121214/7bc1e1ca/attachment.html>


More information about the Users mailing list