I am looking for examples to allow me to change the datastore associated
with a featuretype using REST API for geoserver
One solution is to do a GET on an existing featuretype , extract the XML,
modify the <store> tag and POST it back to the same layer
While this might work but it would not be considered good practice from a REST perspective, because you are changing a resources location based on its representation. ie you would do a PUT against the feature type, but then it would move to another location....
A more RESTful (although less convenient) solution would be to:
1. Do a GET on the feature type, saving its representation
2. Do a DELETE on the feature type
3. Do a POST to the new datastore
-Justin
Is there any other alternative and easier way to do this?
Thanks
Ajay
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
Thanks for the information, yeah I have decided to make my implementation
more RESTful based on ur suggestion.
Another question, do you know if the 1.7.5 version of geoserver's REST
supports having multiple featuretypes for a single shapefile datastore. I
know we can kinda do it through the admin GUI interface, any idea if the
same can be done using REST interface?
Thanks
Ajay
Justin Deoliveira-6 wrote:
Hi Ajay,
ajayr wrote:
Hi
I am looking for examples to allow me to change the datastore associated
with a featuretype using REST API for geoserver
One solution is to do a GET on an existing featuretype , extract the XML,
modify the <store> tag and POST it back to the same layer
While this might work but it would not be considered good practice from
a REST perspective, because you are changing a resources location based
on its representation. ie you would do a PUT against the feature type,
but then it would move to another location....
A more RESTful (although less convenient) solution would be to:
1. Do a GET on the feature type, saving its representation
2. Do a DELETE on the feature type
3. Do a POST to the new datastore
-Justin
Is there any other alternative and easier way to do this?
Thanks
Ajay
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Well in general multiple feature types for a shapefile datastore does not make much sense. Although you are right, the UI does allow you to create a second feature type for a shapefile ds, it seems to mostly override the first though. I would call this a bug.
Regardless, my guess is yes, the REST api would probably allow you to do this but i would advise against it as it will lead to unexpected behavior. There should probably be a check for this case and an error produced.
-Justin
ajayr wrote:
Hey Justin
Thanks for the information, yeah I have decided to make my implementation
more RESTful based on ur suggestion.
Another question, do you know if the 1.7.5 version of geoserver's REST
supports having multiple featuretypes for a single shapefile datastore. I
know we can kinda do it through the admin GUI interface, any idea if the
same can be done using REST interface?
Thanks
Ajay
Justin Deoliveira-6 wrote:
Hi Ajay,
ajayr wrote:
Hi
I am looking for examples to allow me to change the datastore associated
with a featuretype using REST API for geoserver
One solution is to do a GET on an existing featuretype , extract the XML,
modify the <store> tag and POST it back to the same layer
While this might work but it would not be considered good practice from a REST perspective, because you are changing a resources location based on its representation. ie you would do a PUT against the feature type, but then it would move to another location....
A more RESTful (although less convenient) solution would be to:
1. Do a GET on the feature type, saving its representation
2. Do a DELETE on the feature type
3. Do a POST to the new datastore
-Justin
Is there any other alternative and easier way to do this?
Thanks
Ajay
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
Well in general multiple feature types for a shapefile datastore does not make much sense. Although you are right, the UI does allow you to create a second feature type for a shapefile ds, it seems to mostly override the first though. I would call this a bug.
Nope, it's a feature (a sponsored one, too, it was added
along with the ability to set an alias for a layer).
The reasoning is to allow a service to publish the same layer
multiple times with different setups:
- different default style
- different "reproject to" projection
In particular the second was required so that WFS 1.0 clients
(ESRI Arc*) could access the data reprojected in various
ways without knowing anything about WFS 1.1
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
Yeah just as Andrea pointed out, we are using it as a single datastore for
multiple layers that we display, where each layer is shown differently based
on the style.
Though I am not sure if it is a good "REST practise", but unfortunately I
have to implement it that way (due to project requirements).
Thanks for all the help
Ajay
Andrea Aime-4 wrote:
Justin Deoliveira ha scritto:
Hi Ajay,
Well in general multiple feature types for a shapefile datastore does
not make much sense. Although you are right, the UI does allow you to
create a second feature type for a shapefile ds, it seems to mostly
override the first though. I would call this a bug.
Nope, it's a feature (a sponsored one, too, it was added
along with the ability to set an alias for a layer).
The reasoning is to allow a service to publish the same layer
multiple times with different setups:
- different default style
- different "reproject to" projection
In particular the second was required so that WFS 1.0 clients
(ESRI Arc*) could access the data reprojected in various
ways without knowing anything about WFS 1.1
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge
This is your chance to win up to $100,000 in prizes! For a limited time,
vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize
details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
Ok, my apologies, I did not know that this was a feature, makes sense though with our current model for configuration.
That said, I don't believe the REST api will complain if you add multiple feature types to a single datastore. So should work, if not let us know.
-Justin
ajayr wrote:
Yeah just as Andrea pointed out, we are using it as a single datastore for
multiple layers that we display, where each layer is shown differently based
on the style.
Though I am not sure if it is a good "REST practise", but unfortunately I
have to implement it that way (due to project requirements).
Thanks for all the help
Ajay
Andrea Aime-4 wrote:
Justin Deoliveira ha scritto:
Hi Ajay,
Well in general multiple feature types for a shapefile datastore does not make much sense. Although you are right, the UI does allow you to create a second feature type for a shapefile ds, it seems to mostly override the first though. I would call this a bug.
Nope, it's a feature (a sponsored one, too, it was added
along with the ability to set an alias for a layer).
The reasoning is to allow a service to publish the same layer
multiple times with different setups:
- different default style
- different "reproject to" projection
In particular the second was required so that WFS 1.0 clients
(ESRI Arc*) could access the data reprojected in various
ways without knowing anything about WFS 1.1
Cheers
Andrea
--
Andrea Aime
OpenGeo - http://opengeo.org
Expert service straight from the developers.
------------------------------------------------------------------------------
Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have
the opportunity to enter the BlackBerry Developer Challenge. See full
prize details at: http://p.sf.net/sfu/Challenge
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-users
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.