Leaflet search box to display element from online WMS

179 views
Skip to first unread message

Laurent

unread,
Jan 12, 2018, 2:46:14 PM1/12/18
to Leaflet

I'm using Leaflet to create a service for people on a small island in France where land property is numerous and scattered. I'd like to offer them a way to easily locate their property in the field using their mobile phone. 

I have access to a WMS base that can been seen and accessed here (in French, unfortunately) :https://geobretagne.fr/geonetwork/srv/fre/catalog.search#/metadata/caa72dc0-9abe-43bb-a722-d6463a9a7227

Code in Leaflet is : 

var options4 = {
   layers: 'CP.CadastralParcel', 
        style : 'inspire_common_DEFAULT', // display style for transparency
        attribution: 'GeoBretagne', 
        minZoom: 10,
        maxZoom: 18,
        opacity: 1.0,
        format: 'image/png',
        transparent: true,
        tms: false
    };
    layer4 = L.tileLayer.wms('https://geobretagne.fr/geoserver/cadastre/ows?', options4).addTo(map);

What I would like to do is add a search box where the user could type a parcel reference and have this parcel highlighted on the parcel map and screen move to that point. 

Parcels are referenced in the form of FRDDCCCPPPSSNN. For the island I'm working on, DDCCCPP is 29 155 000 (Department : 29, city code : 0155, prefix : 000). Search would only affect the last part of the reference where SS is for Section and is in the form 00 (sections are 0A, 0B... 0Q) and PP is Parcel (0000 to 9999). People usually look for reference typing for exemple G23 that would automatically be converted to 0G0023 to match the reference format.

Click in QGIS on parcel A342 returns : 

> Results for FeatureType
> 'http://geobretagne.fr/ns/cadastre/:CP.CadastralParcel':
> -------------------------------------------- inspireid = FR291550000A0342 geo_parcelle = 20152901550000A0342 geometry =
> [GEOMETRY (Polygon) with 8 points] label = 342
> nationalcadastralreference = 1550000A0342 areavalue = 1840 departement
> = 29 geo_section = 20151550000A geo_subdsect = 20151550000A01 geo_indp = 01 beginlifespanversion = septembre 2016 endlifespanversion = septembre 2017 coar = null tex2 = null codm = null creat_date =
> 2007-12-19 update_dat = 2015-08-13
> --------------------------------------------

I'm not really good at javascript and GIS, just a beginner. So any help would be very appreciated. Thanks a lot in advance ! 

(Future feature would turn the device into a search compas, orienting the map on screen and display distance between user and searched parcel.)

Reply all
Reply to author
Forward
0 new messages