Okay teste directory...XML only gives path name which is correct!

to get shape filename you should look at the *nativeName* attribute in the
XML, and add  ".shp" to that

example url
http://localhost:8080/geoserver/rest/workspace/ws_name/datastores/ds_name/featureTypes/layer_name.xml

Vikram <vikram.es...@fleetroute.com> escreveu no dia quinta, 23/01/2020
à(s) 15:20:

> 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>
> <entry key="charset">ISO-8859-1</entry>
> <entry key="filetype">shapefile</entry>
> <entry key="create spatial index">true</entry>
> <entry key="memory mapped buffer">false</entry>
> <entry key="timezone">Europe/Lisbon</entry>
> <entry key="enable spatial index">true</entry>
> <entry key="namespace">namespace</entry>
> <entry key="cache and reuse memory maps">true</entry>
> *<entry key="url">file:data/shapefiles/states.shp</entry>*
> ...
>
> or do you mean adding a store as Directory of spatial files (shapefiles)?
>
> Vikram <vikram.es...@fleetroute.com> 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
>> <http://localhost:8080/geoserver/rest/layers/layername.xml>*
>>
>> parse XML and fetch the first_url value
>>
>> <resource class="featureType">
>> <name>workspace:layername</name>
>> <atom:link xmlns: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
>>
>> <store class="dataStore">
>> <name>workspace:storename</name>
>> <atom:link xmlns: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 <vikram.es...@fleetroute.com> 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 <vikram.es...@fleetroute.com> 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
>>>>
>>>>
>>>> Geoserver-users@lists.sourceforge.net
>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users
>>>>
>>>
>>>
>>> --
>>>
>>> www.vfonsecaz.pt
>>>
>>>
>>
>> --
>>
>> www.vfonsecaz.pt
>>
>>
>
> --
>
> www.vfonsecaz.pt
>
>

-- 

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


Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Reply via email to