[OpenLayers-Users] geojson - additional questions

Paul Meems (Top-X) p.meems at topx-group.nl
Mon Apr 23 04:27:38 EDT 2012


Hi Jan,

I'm also still learning OL ;)
I'm using

displayOutsideMaxExtent: true

I believe it makes it possible to zoom beyond the extent.

I have no experience with geoJson and how to read it's values.
But if you've loaded it as a layer you can read the attributes:

showAttributes(yourLayer.features);

function showAttributes(features){   if (features.length == 0)  {
document.getElementById('progress').innerHTML = 'Error no features
found!';    return;  }  var data = '<h2>Number of features: ' +
features.length + '</h2>';  data += "<table id='attributeInfo'
class='tablesorter'>";  data += getTableHeaders(features[0]);  data +=
'<tbody>';  var featureID;  for (featureID in features)  {     var
myFeature = features[featureID];    data += '<tr>';    var key = 0;
for(key in myFeature.attributes)    {       data += '<td>' +
formatString(myFeature.attributes[key],2) + '</td>';    }    data +=
'</tr>';  }  data += "</tbody></table>";
document.getElementById('attributen').innerHTML = data; }

I hope it helps.

Your from Germany, right? Interested in going to the 4-day Open Source GIS
conference in Velp (near Arnhem)?

Regards


Paul Meems
Organizing the International Open Source GIS conference in The Netherlands:
http://www.mapwindow.org/conference/2012/

Op 22 april 2012 18:51 schreef Jan Tappenbeck <osm at tappenbeck.net> het
volgende:

> Hi !
>
> thanks - and i read something about geojson at this weekend and i have
> some additional questions:
>
> * if a bbox is define - is it possible to zoom extant to this by ol ? how ?
>
>
> is it possible to iterate through the geojson-data -> get a list of all
> name-properties
>
> is it correct to define a name-property like this:
>
> ...
> { "type": "Feature",
>       "geometry": {
>         "type": "Polygon",
>         "coordinates": [
>           [ [100.0, 0.0], [101.0, 0.0], [101.0, 1.0],
>             [100.0, 1.0], [100.0, 0.0] ]
>           ]
>       },
>       "properties": {
>         "name": "[the name]",   <<<<<<<<<<<<---------------
>         "prop1": {"this": "that"}
>         }
>       }
> ....
>
>
> regards Jan :-)
>
>
> Am 20.04.2012 13:05, schrieb Paul Meems (Top-X):
>
>> Hi Jan,
>>
>> I'm using a filter for this:
>>
>>   filter: new OpenLayers.Filter.Comparison({
>>           type: OpenLayers.Filter.Comparison.**EQUAL_TO,
>>           property:"_adresid",
>>           value:"-1"})
>>
>> and some javascript
>>
>> function changeFilter(newValue)
>> {
>>   wfsLayer.destroyFeatures();
>>   document.getElementById('**progress').innerHTML ="..";
>>   wfsLayer.filter = new OpenLayers.Filter.Comparison({
>>                           type: OpenLayers.Filter.Comparison.**EQUAL_TO,
>>                           property:"_adresid",
>>                           value: newValue});
>>   wfsLayer.refresh({force: true});
>> }
>>
>>
>> Regards
>>
>>
>> Paul Meems
>> Organizing the International Open Source GIS conference in The
>> Netherlands:
>> http://www.mapwindow.org/**conference/2012/<http://www.mapwindow.org/conference/2012/>
>>
>> Op 20 april 2012 11:33 schreef Jan Tappenbeck
>> <osm at tappenbeck.net
>> <mailto:osm at tappenbeck.net>> het volgende:
>>
>>    hi !
>>
>>    i want to make a map with a function to show streets via a search
>>    dialog.
>>
>>    when a user select a way-name it should be show via a openlayer-vector.
>>
>>    i only found examples to define elements by the geojson-format and
>>    show all elements in a bundle - but i only want to show the element
>>    with the id=xxxx.
>>
>>    did anyone now an expample for this situation ?
>>
>>    regards Jan :-)
>>    ______________________________**___________________
>>    Users mailing list
>>    Users at lists.osgeo.org
>>    <mailto:Users at lists.osgeo.org>
>>    http://lists.osgeo.org/__**mailman/listinfo/openlayers-__**users<http://lists.osgeo.org/__mailman/listinfo/openlayers-__users>
>>    <http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>> >
>>
>>
>>
>>
>> ______________________________**_________________
>> Users mailing list
>> Users at lists.osgeo.org
>> http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>>
>
>
> ______________________________**_________________
> Users mailing list
> Users at lists.osgeo.org
> http://lists.osgeo.org/**mailman/listinfo/openlayers-**users<http://lists.osgeo.org/mailman/listinfo/openlayers-users>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120423/85d0c7ef/attachment-0001.html


More information about the Users mailing list