[MapQuery] Adding colored vectors to a map

Volker Mische volker.mische at gmail.com
Thu Feb 9 09:57:05 EST 2012


Hi David,

currently you can't add new features manually, but I'm working on it.

To colour you features, you have to use plain OpenLayers. You can pass
in your styles with the vector layers with the "styleMap" property. It
takes an OpenLayers.StyleMap as value.

See the OpenLayers documentation for more information about StyleMap [1].

[1] http://docs.openlayers.org/library/feature_styling.html

Cheers,
  Volker

On 02/08/2012 05:38 PM, David Lozano wrote:
> Hi all,
> 
> I'll start telling you that I'm a complete newby to mapquery, so maybe
> this question has a very simple response, but I've been unable to find it.
> 
> I'm creating a map using mapquery. Relevant source code is:
> 
> $('#map').mapQuery({
>   center: {
>     box: [5.75, 47, 15, 55]
>   },
>   layers:  [{
>     type: 'json',
>     url: 'germany.geojson',
>     label: 'Germany'
>   }]
> });
> 
> this simple code shows me a centered map of Germany.
> 
> Now, I want to add colored points at certain cities (red or green
> points, depending of some values)... but I'm not able to add these
> points to the map.
> 
> At most, I've been able to add these points adding a new json layer to
> layers list, with a different url (stations.php). This PHP file
> generates a file like this one:
> 
> {
>  "type": FeatureCollection",
>  "features": [{
>   "type": "Feature",
>   "geometry": {
>    "type": "Point",
>    "coordinates": [x, y]
>    }
>  }]
> }
> 
> That way I can add the points, but I've found no way to apply colour to
> these points. I've tried adding an "style" property to the feature, but
> it doesn't work.
> 
> It shouldn't be too complicated, but I've no clue... any help?
> 
> Thanks a lot!
> 
> David (aka sharcashmo)
> -- 
> <http://hphayquedecirlomas.wordpress.com/>
> 
> HIJOS DE PUTA! Hay que decirlo más... Haz click en la imagen para
> decirlo más
> 
> 
> 
> _______________________________________________
> MapQuery mailing list
> MapQuery at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapquery



More information about the MapQuery mailing list