Did you test a directory of shapefiles or a single shapefile as a datastore ? I am talking about a directory..

On 23/01/2020 16:15, Vitor Fonseca wrote:

I testes a shapefile datastore and the xml gives me full path with filename

<connectionParameters>
<entrykey="charset">ISO-8859-1</entry>
<entrykey="filetype">shapefile</entry>
<entrykey="create spatial index">true</entry>
<entrykey="memory mapped buffer">false</entry>
<entrykey="timezone">Europe/Lisbon</entry>
<entrykey="enable spatial index">true</entry>
<entrykey="namespace">namespace</entry>
<entrykey="cache and reuse memory maps">true</entry>
*<entrykey="url">file:data/shapefiles/states.shp</entry>*
...

or do you mean adding a store as Directory of spatial files (shapefiles)?

Vikram <[email protected] <mailto:[email protected]>> escreveu no dia quinta, 23/01/2020 à(s) 14:33:

    Thanks, yeah this works well.

    What if I have a directory of shapefiles ? How do I know which
    layer represents which shape file ?

    The XML response would only give you the directory name..

    Thanks again !

    On 23/01/2020 15:02, Vitor Fonseca wrote:

    in that case you should use rest to get the layer featuretype and
    then get the datastore from the featuretype url

    *first*
    /http://localhost:8080/geoserver/rest/layers/layername.xml/

    parse XML and fetch the first_url value

    <resourceclass="featureType">
    <name>workspace:layername</name>
    
<atom:linkxmlns:atom="http://www.w3.org/2005/Atom"rel="alternate"href="*first_url*"type="application/xml"/>
    </resource>

    *second*
    call the first_url, parse XML and fetch the second_url value

    <storeclass="dataStore">
    <name>workspace:storename</name>
    
<atom:linkxmlns:atom="http://www.w3.org/2005/Atom"rel="alternate"href="*second_url*"type="application/xml"/>
    </store>

    *last*
    call second_url and fetch the result looking for the key value of:
    /<datastore><connectionParameters><entry key="url"><value></entry>
    /in the response XML


    Vikram <[email protected]
    <mailto:[email protected]>> escreveu no dia quinta,
    23/01/2020 à(s) 13:47:

        Thanks. Is there also a way to get the shapefile path using
        the layer name ?

        For example, If I publish a layer A using a shapefile X (data
        store), Is it possible to get the path or the fullname of X
        using the layer name "A" ?


        -Vikram

        On 23/01/2020 13:44, Vitor Fonseca wrote:
        I would use the rest API.

        doesn't refer javascript but you could start here
        
https://docs.geoserver.org/stable/en/user/rest/stores.html#listing-store-details

        to access geoserver rest API you will also need to deal with
        authentication in client side (maybe using ajax/XMLHttpRequest)

        then you could fetch the store details rest endpoint
        e.g.
        
http://localhost:8080/geoserver/rest/workspaces/acme/datastores/roads.xml


        and parse the response with a xml parser to find what you're
        looking for

        Vikram <[email protected]
        <mailto:[email protected]>> escreveu no dia
        quinta, 23/01/2020 à(s) 12:26:

            Hi all,

            is there a way to get the connection parameters for ex,
            the location of
            a shapefile of a data store in Geoserver ?

            I want to get this through a URL request from a client
            (javascript
            preferably. if not, Java).

            Regards,

            Vikram



            _______________________________________________
            Geoserver-users mailing list

            Please make sure you read the following two resources
            before posting to this list:
            - Earning your support instead of buying it, but Ian
            Turton: http://www.ianturton.com/talks/foss4g.html#/
            - The GeoServer user list posting guidelines:
            http://geoserver.org/comm/userlist-guidelines.html

            If you want to request a feature or an improvement, also
            see this:
            
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


            [email protected]
            <mailto:[email protected]>
            https://lists.sourceforge.net/lists/listinfo/geoserver-users



--
        www.vfonsecaz.pt <http://www.vfonsecaz.pt>



--
    www.vfonsecaz.pt <http://www.vfonsecaz.pt>



--

www.vfonsecaz.pt <http://www.vfonsecaz.pt>

_______________________________________________
Geoserver-users mailing list

Please make sure you read the following two resources before posting to this 
list:
- Earning your support instead of buying it, but Ian Turton: 
http://www.ianturton.com/talks/foss4g.html#/
- The GeoServer user list posting guidelines: 
http://geoserver.org/comm/userlist-guidelines.html

If you want to request a feature or an improvement, also see this: 
https://github.com/geoserver/geoserver/wiki/Successfully-requesting-and-integrating-new-features-and-improvements-in-GeoServer


[email protected]
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to