I have got 1.7.x compiled and confirmed that RESTconfig is running.
Now I want to accomplish the following:
1. I have some postGIS tables that are listed as not yet configured.
I can see them listed under "Unconfigured FeatureTypes" when I on run a GET
to rest/folders/{folder}/layers.
It says that I can run a PUT or POST to configure a new layer into Geoserver
if I am going to POST, what kind of key-value pairs should be submitted ?
2. I have a shapefile set (zipped), how can I upload it and tell RESTconfig
to configure the shapefile as a Geoserver layer ?
I know there is a lot of effort spent on RESTconfig, but I don't find much
documents on how to use it.
If I figure out how to do the above, I will be happy to contribute something
to the Wiki.
I have got 1.7.x compiled and confirmed that RESTconfig is running.
Now I want to accomplish the following:
1. I have some postGIS tables that are listed as not yet configured.
I can see them listed under "Unconfigured FeatureTypes" when I on run a GET
to rest/folders/{folder}/layers.
It says that I can run a PUT or POST to configure a new layer into Geoserver
if I am going to POST, what kind of key-value pairs should be submitted ?
I believe you have a few options of what type of content you post. XML, JSON, etc... I am not sure if the exact format is documented anywhere? David?
2. I have a shapefile set (zipped), how can I upload it and tell RESTconfig
to configure the shapefile as a Geoserver layer ?
There is. I asked David about how to do this but i could get it to work myself. David?
I know there is a lot of effort spent on RESTconfig, but I don't find much
documents on how to use it.
If I figure out how to do the above, I will be happy to contribute something
to the Wiki.
That would be great. As you probably know the RESTConfig module is still experimental. One of my tasks over the next couple of weeks is to move it to supported. So hopefully things will be getting better soon.
Cheers.
Dukie
Raleigh, NC, USA
--
Justin Deoliveira
OpenGeo - http://opengeo.org
Enterprise support for open source geospatial.
I checked out this issue and found that there was, in fact, a bug in the RESTConfig shapefile upload handling code. It's fixed in SVN and will be available when 1.7.2 is released.
If you download and rebuild RESTConfig now, the proper request using curl will be:
curl http://user:passwd@anonymised.com:port/geoserver/rest/folders/dir/layers/typename/file.shp -T /path/to/shapefile.zip
I have got 1.7.x compiled and confirmed that RESTconfig is running.
Now I want to accomplish the following:
1. I have some postGIS tables that are listed as not yet configured.
I can see them listed under "Unconfigured FeatureTypes" when I on run a GET
to rest/folders/{folder}/layers.
It says that I can run a PUT or POST to configure a new layer into Geoserver
if I am going to POST, what kind of key-value pairs should be submitted ?
I believe you have a few options of what type of content you post. XML, JSON, etc... I am not sure if the exact format is documented anywhere? David?
2. I have a shapefile set (zipped), how can I upload it and tell RESTconfig
to configure the shapefile as a Geoserver layer ?
There is. I asked David about how to do this but i could get it to work myself. David?
I know there is a lot of effort spent on RESTconfig, but I don't find much
documents on how to use it.
If I figure out how to do the above, I will be happy to contribute something
to the Wiki.
That would be great. As you probably know the RESTConfig module is still experimental. One of my tasks over the next couple of weeks is to move it to supported. So hopefully things will be getting better soon.
David, thanks. I have got hold of the latest revision in svn, recompiled. Yes, uploading worked as described, and new shapefile datastore and a new layer is created.
There is still one more problem, the layer doesn’t show properly when viewed from the geoserver demo page. I have yet to look into what exactly is going on.
BTW. the zipped shapefile sets used was a direct export from a PostGIS layer via Geoserver using output format shape-zip.
> From: David Winslow dwinslow@anonymised.com > Subject: Re: [Geoserver-devel] RE STconfig status and howto > To: “Justin Deoliveira” jdeolive@anonymised.com > Cc: “dukie” myjiang@anonymised.com, geoserver-devel@lists.sourceforge.net > Date: Tuesday, January 6, 2009, 3:49 PM > > <br>> I checked out this issue and found that there was, in fact, a bug in the<br>> RESTConfig shapefile upload handling code. It's fixed in SVN and will be<br>> available when 1.7.2 is released.<br>> <br>> If you download and rebuild RESTConfig now, the proper request using curl will<br>> be:<br>> curl<br>> http://user:passwd@anonymised.com:port/geoserver/rest/folders/dir/layers/typename/file.shp<br>> -T /path/to/shapefile.zip<br>> <br>> However, this is likely to change before 1.7.2 comes out. You can see the<br>> proposed redesign and some example code at<br>> http://geoserver.org/display/GEOSDOC/RESTful+Configuration+API<br>> <br>> David Winslow<br>> <br>> Justin Deoliveira wrote:<br>> > dukie wrote:<br>> >> I have got 1.7.x compiled and confirmed that RESTconfig is running.<br>> >> <br>> >> Now I want to accomplish<br>> the following:<br>> >> <br>> >> 1. I have some postGIS tables that are listed as not yet configured.<br>> >> I can see them listed under "Unconfigured FeatureTypes" <br>> when I on run a GET<br>> >> to rest/folders/{folder}/layers.<br>> >> <br>> >> In the only documentation I can find on<br>> >> http://geoserver.org/display/GEOSDOC/RESTful+Configuration+API<br>> >> <br>> >> It says that I can run a PUT or POST to configure a new layer into<br>> Geoserver<br>> >> if I am going to POST, what kind of key-value pairs should be<br>> submitted ?<br>> >> <br>> > I believe you have a few options of what type of content you post. XML,<br>> JSON, etc... I am not sure if the exact format is documented anywhere? David?<br>> > <br>> >> <br>> >> 2. I have a shapefile set (zipped), how can I upload it and tell<br>> RESTconfig<br>> >> to configure the shapefile as a Geoserver layer ?<br>> > There is. I asked David<br>> about how to do this but i could get it to work<br>> myself. David?<br>> > <br>> >> <br>> >> I know there is a lot of effort spent on RESTconfig, but I don't<br>> find much<br>> >> documents on how to use it.<br>> >> If I figure out how to do the above, I will be happy to contribute<br>> something<br>> >> to the Wiki.<br>> > <br>> > That would be great. As you probably know the RESTConfig module is still<br>> experimental. One of my tasks over the next couple of weeks is to move it to<br>> supported. So hopefully things will be getting better soon.<br>> >> <br>> >> Cheers.<br>> >> <br>> >> Dukie<br>> >> <br>> >> Raleigh, NC, USA<br>> >> <br>> >> <br>> >> <br>> >> <br>> > <br>> > <br>> <br>>
Could you be a bit more specific about what's wrong? One thing I can
think of that might be causing a problem is that RESTConfig currently
does not inspect the geometry type of the new layer when setting the
default style; it just uses 'polygon' for any new layers. This would
keep a line or point layer from being rendered. You can try setting the
style manually through the admin interface or via a query parameter
(&styles=point or &styles=line) in the getmap request.
Hope this helps,
David Winslow
On Thu, 2009-01-08 at 22:32 -0800, Ming Ya Jiang wrote:
David, thanks. I have got hold of the latest revision in svn,
recompiled.
Yes, uploading worked as described, and new shapefile datastore and a
new layer
is created.
There is still one more problem, the layer doesn't show properly when
viewed
from the geoserver demo page. I have yet to look into what exactly is
going on.
BTW. the zipped shapefile sets used was a direct export from a
PostGIS layer via
Geoserver using output format shape-zip.
Dukie
--- On Tue, 1/6/09, David Winslow <dwinslow@anonymised.com> wrote:
From: David Winslow <dwinslow@anonymised.com>
Subject: Re: [Geoserver-devel] RE STconfig status and howto
To: "Justin Deoliveira" <jdeolive@anonymised.com>
Cc: "dukie" <myjiang@anonymised.com>,
geoserver-devel@lists.sourceforge.net
Date: Tuesday, January 6, 2009, 3:49 PM
I checked out this issue and found that there was, in fact, a bug in the
RESTConfig shapefile upload handling code. It's fixed in SVN and will be
available when 1.7.2 is released.
If you download and rebuild RESTConfig now, the proper request using curl will
be:
curl http://user:passwd@anonymised.com:port/geoserver/rest/folders/dir/layers/typename/file.shp
-T /path/to/shapefile.zip
Justin Deoliveira wrote:
> dukie wrote:
>> I have got 1.7.x compiled and confirmed that RESTconfig is running.
>>
>> Now I want to accomplish
the following:
>>
>> 1. I have some postGIS tables that are listed as not yet configured.
>> I can see them listed under "Unconfigured FeatureTypes"
when I on run a GET
>> to rest/folders/{folder}/layers.
>>
>> In the only documentation I can find on
>> http://geoserver.org/display/GEOSDOC/RESTful+Configuration+API
>>
>> It says that I can run a PUT or POST to configure a new layer into
Geoserver
>> if I am going to POST, what kind of key-value pairs should be
submitted ?
>>
> I believe you have a few options of what type of content you post. XML,
JSON, etc... I am not sure if the exact format is documented anywhere? David?
>
>>
>> 2. I have a shapefile set (zipped), how can I upload it and tell
RESTconfig
>> to configure the shapefile as a Geoserver layer ?
> There is. I asked David
about how to do this but i could get it to work
myself. David?
>
>>
>> I know there is a lot of effort spent on RESTconfig, but I don't
find much
>> documents on how to use it.
>> If I figure out how to do the above, I will be happy to contribute
something
>> to the Wiki.
>
> That would be great. As you probably know the RESTConfig module is still
experimental. One of my tasks over the next couple of weeks is to move it to
supported. So hopefully things will be getting better soon.
>>
>> Cheers.
>>
>> Dukie
>>
>> Raleigh, NC, USA
>>
>>
>>
>>
>
>
------------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It is the best place to buy or sell services for
just about anything Open Source. http://p.sf.net/sfu/Xq1LFB
_______________________________________________ Geoserver-devel mailing list Geoserver-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/geoserver-devel
The actualy datastore and featureType (layer) generated via the Geoserver web client are:
when viewed via the Feature Data Set Editor, there is a new Feature Data Set (id : shapes) with url : file:/opt/tomcat/webapps/geoserver/data/data/shapes/shapes.shp
when looking at the catalog.xml, there is new entry as following.
So one bit of surprise (to me at least) is that the shape file has been renamed to shapes.shp while I specified in the URL as ‘/rest/folders/shapes/layers/building/file.shp’. I was intutively (?) thinking that what comes after ‘/layers/’ should be the name of the featuretype, what comes before ‘/layers/’ (ie, shapes) should be the name of the folder containing the new layers. But I guess one could argue that shapes is the name of the datastore, and in the case of shapefile datastores, the name of the featuretype should be the same as that of the datastore, so what I specified after /layers/ (building) is ignored. So I am ok with the behavior.
When looking into the /data/featureTypes folder, there is a new folder shapes_shapes which contains the info.xml file with these contents
shapes
32029 0 shapes_Type Generated from shapes /
shapes
0
Comparing this with the info.xml file for the PostGIS layer (which is the source of the building.zip dataset) created on the same server, which looks like this
building
32029 0 building_Type Generated from lead /
building, lead
0
You can see that there are obvious discrepency for the latLonBoundingBox coodinates for the values of minx/miny/maxx/maxy, so it seems there is a mistake made in calculating these values from the given shapefiles. The nativeBBox, on the other hand, are a good match.
This explains why the new layers created using the above method doesn’t work.
Also when I try to edit the new featureType via the Geoserver Feature Editor, I got the following error.
The following exception was thrown:
- class javax.servlet.ServletException: ServletException in ‘/WEB-INF/pages/data/featureTypes/Editor.jsp’: Getter for property attributeNames threw exception: java.lang.ClassCastException: org.vfny.geoserver.form.data.AttributeForm
Details:
<br>javax.servlet.ServletException: ServletException in '/WEB-INF/pages/data/featureTypes/Editor.jsp': Getter for property attributeNames threw exception: java.lang.ClassCastException: org.vfny.geoserver.form.data.AttributeForm<br> at org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)<br> at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)<br> at org.apache.jsp.WEB_002dINF.pages.layouts.mainLayout_jsp._jspService(mainLayout_jsp.java:652)<br> at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)<br> at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)<br> at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)<br> at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)<br> at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)<br>(... omitted) <br>which<br> seems to indicate there are some other errors with parsing the shapefile set, which<br>I suspect is an unrelated bug.<br><br>Anyway, that's the full scope of what happened when I attempt to use RESTconfig<br>to autoconfigure a layer into Geoserver.<br><br>I am willing to take a deeper look into the RESTconfig code and to see if I can fix this,<br>perhaps as my first foray into contributing something back to the geoserver project.. :-)<br><br>Dukie<br><br><br>
> From: David Winslow dwinslow@anonymised.com > Subject: Re: [Geoserver-devel] RE STconfig status and howto > To: myjiang@anonymised.com > Cc: “Justin Deoliveira” jdeolive@anonymised.com, geoserver-devel@lists.sourceforge.net > Date: Friday, January 9, 2009, 10:23 AM > > <br>> Could you be a bit<br>> more specific about what's wrong? One thing I can<br>> think of that might be causing a problem is that RESTConfig currently<br>> does not inspect the geometry type of the new layer when setting the<br>> default style; it just uses 'polygon' for any new layers. This would<br>> keep a line or point layer from being rendered. You can try setting the<br>> style manually through the admin interface or via a query parameter<br>> (&styles=point or &styles=line) in the getmap request.<br>> <br>> Hope this helps,<br>> David Winslow<br>> <br>> On Thu, 2009-01-08 at 22:32 -0800, Ming Ya Jiang wrote:<br>> > David, thanks. I have got hold of the latest revision in svn,<br>> > recompiled.<br>> > Yes, uploading worked as described, and new shapefile datastore and a<br>> > new layer <br>> > is created. <br>> > <br>> > There is still one more problem, the layer doesn't show properly when<br>> > viewed<br>> > from the geoserver demo page. I have yet to look into what<br>> exactly is<br>> > going on.<br>> > <br>> > BTW. the zipped shapefile sets used was a direct export from a<br>> > PostGIS layer via<br>> > Geoserver using output format shape-zip.<br>> > <br>> > Dukie<br>> > <br>> > --- On Tue, 1/6/09, David Winslow <dwinslow@anonymised.com> wrote:<br>> > From: David Winslow <dwinslow@anonymised.com><br>> > Subject: Re: [Geoserver-devel] RE STconfig status and howto<br>> > To: "Justin Deoliveira" <jdeolive@anonymised.com><br>> > Cc: "dukie" <myjiang@anonymised.com>,<br>> > geoserver-devel@lists.sourceforge.net<br>> > Date: Tuesday, January 6, 2009, 3:49 PM<br>> > <br>> > I checked out this issue and found that there was, in fact, a bug<br>> in the<br>> > RESTConfig shapefile upload handling code. It's fixed in SVN<br>> and will be<br>> > available when 1.7.2 is released.<br>> > <br>> > If you<br>> download and rebuild RESTConfig now, the proper request<br>> using curl will<br>> > be:<br>> > curl<br>> > <br>> http://user:passwd@anonymised.com:port/geoserver/rest/folders/dir/layers/typename/file.shp<br>> > -T /path/to/shapefile.zip<br>> > <br>> > However, this is likely to change before 1.7.2 comes out. You can<br>> see the<br>> > proposed redesign and some example code at<br>> > http://geoserver.org/display/GEOSDOC/RESTful+Configuration+API<br>> > <br>> > <br>> > David Winslow<br>> > <br>> > Justin Deoliveira wrote:<br>> > > dukie wrote:<br>> > >> I have got 1.7.x compiled and confirmed that RESTconfig<br>> is running.<br>> > >> <br>> > >> Now I want to accomplish<br>> > the following:<br>> > >> <br>> > >> 1. I have some postGIS tables that are listed as<br>> not yet<br>> configured.<br>> > >> I can see them listed under "Unconfigured<br>> FeatureTypes" <br>> > when I on run a GET<br>> > >> to rest/folders/{folder}/layers.<br>> > >> <br>> > >> In the only documentation I can find on<br>> > >><br>> http://geoserver.org/display/GEOSDOC/RESTful+Configuration+API<br>> > >> <br>> > >> It says that I can run a PUT or POST to configure a new<br>> layer into<br>> > Geoserver<br>> > >> if I am going to POST, what kind of key-value pairs<br>> should be<br>> > submitted ?<br>> > >> <br>> > > I believe you have a few options of what type of content you<br>> post. XML,<br>> > JSON, etc... I am not sure if the exact format is documented<br>> anywhere? David?<br>> > > <br>> > >> <br>> > >> 2. I have a shapefile set<br>> (zipped), how can I upload it<br>> and tell<br>> > RESTconfig<br>> > >> to configure the shapefile as a Geoserver layer ?<br>> > > There is. I asked David<br>> > about how to do this but i could get it to work<br>> > myself. David?<br>> > > <br>> > >> <br>> > >> I know there is a lot of effort spent on RESTconfig, <br>> but I don't<br>> > find much<br>> > >> documents on how to use it.<br>> > >> If I figure out how to do the above, I will be happy to<br>> contribute<br>> > something<br>> > >> to the Wiki.<br>> > > <br>> > > That would be great. As you probably know the RESTConfig<br>> module is still<br>> > experimental. One of my tasks over the next couple of weeks is to<br>> move it to<br>> > supported. So hopefully things will be getting better soon.<br>> > <br>> >> <br>> > >> Cheers.<br>> > >> <br>> > >> Dukie<br>> > >> <br>> > >> Raleigh, NC, USA<br>> > >> <br>> > >> <br>> > >> <br>> > >> <br>> > > <br>> > > <br>> > <br>> > <br>> ><br>> ------------------------------------------------------------------------------<br>> > Check out the new SourceForge.net Marketplace.<br>> > It is the best place to buy or sell services for<br>> > just about anything Open Source.<br>> > http://p.sf.net/sfu/Xq1LFB<br>> > _______________________________________________ Geoserver-devel mailing<br>> list Geoserver-devel@lists.sourceforge.net<br>> https://lists.sourceforge.net/lists/listinfo/geoserver-devel<br>> <br>>
Well, as soon as I sent out the last email describing the details of the error, I went into and looked for the code that is responsible for the creation of the native and latlong bounding box, and fixed the error, Recompiled, and now it is all working !
The problem is as follows: in src/main/java/org/geoserver/restconfig/DataStoreFileResource.java
The code uses FeatureSourceUtils.getBoundingBoxEnvelope(source) to mistakenly return the LatLonBBox, while it really returns the native BBox.
I also created a new method RESTutils.convertLatLongFromNativeBBox in src/main/java/org/geoserver/restconfig/RESTUtils.java
Recompiled, and it worked.
Let me know if you need to be send the diff to you for the fix.
On Sun, 2009-01-11 at 19:48 -0800, Ming Ya Jiang wrote:
Well, as soon as I sent out the last email describing the details of
the error,
I went into and looked for the code that is responsible for the
creation of the
native and latlong bounding box, and fixed the error, Recompiled, and
now
it is all working !
The problem is as follows:
in
src/main/java/org/geoserver/restconfig/DataStoreFileResource.java
The code uses FeatureSourceUtils.getBoundingBoxEnvelope(source) to
mistakenly return
the LatLonBBox, while it really returns the native BBox.
I also created a new method RESTutils.convertLatLongFromNativeBBox in
src/main/java/org/geoserver/restconfig/RESTUtils.java
Recompiled, and it worked.
Let me know if you need to be send the diff to you for the fix.
I have a pair of other questions about how to use RESTconfig.
1. How to specify a namespace prefix when configuring a layer. It defaults to “topp” It says somewhere to specify namespace=$namespace. I tried to attach that to the URL and that doesn’t work. If it is a POST, I suppose I can add that as a separate form field. Can I do the same with PUT ?
2. How to configure a PostGIS table already existing in a postGIS datastore ?
> From: David Winslow dwinslow@anonymised.com > Subject: Re: [Geoserver-devel] RE STconfig status and howto > To: myjiang@anonymised.com > Cc: “Justin Deoliveira” jdeolive@anonymised.com, geoserver-devel@lists.sourceforge.net > Date: Monday, January 12, 2009, 10:14 AM > > <br>> On Sun, 2009-01-11 at 19:48 -0800, Ming Ya Jiang wrote:<br>> > Well, as soon as I sent out the last email describing the details of<br>> > the error,<br>> > I went into and looked for the code that is responsible for the<br>> > creation of the<br>> > native and latlong bounding box, and fixed the error, Recompiled, and<br>> > now<br>> > it is all working !<br>> > <br>> > The problem is as follows:<br>> > in<br>> > src/main/java/org/geoserver/restconfig/DataStoreFileResource.java<br>> > <br>> > The code uses FeatureSourceUtils.getBoundingBoxEnvelope(source) to<br>> > mistakenly return<br>> > the LatLonBBox, while it really returns the native BBox.<br>> > <br>> > I also created a new method RESTutils.convertLatLongFromNativeBBox in<br>> ><br>> src/main/java/org/geoserver/restconfig/RESTUtils.java<br>> > <br>> > Recompiled, and it worked.<br>> > <br>> > Let me know if you need to be send the diff to you for the fix.<br>> > <br>> > Dukie<br>> > <br>> > <br>> > <br>> <br>> That's great, I'd love to see a patch.<br>> <br>> David Winslow<br>> <br>>
On Tue, 2009-01-13 at 18:22 -0800, Ming Ya Jiang wrote:
David, attached is the patch file.
I have a pair of other questions about how to use RESTconfig.
1. How to specify a namespace prefix when configuring a layer. It
defaults to "topp"
It says somewhere to specify namespace=$namespace. I tried to attach
that
to the URL and that doesn't work. If it is a POST, I suppose I can
add that
as a separate form field. Can I do the same with PUT ?
2. How to configure a PostGIS table already existing in a postGIS
datastore ?
Dukie.
Raleigh, NC
1. I am curious about where you found that parameter; the current
RESTConfig API completely ignores query parameters and instead looks at
the body of the request for all changes made. Namespaces are assigned
per-datastore (aka 'folder' as exposed right now, 'workspace' in the new
proposal) and are not a layer parameter. If you download the .json
or .xml version of the folder configuration, you should see a namespace
field that you can just edit before PUTting the new configuration.
2. Configuring a PostGIS table from an existing datastore: The current
mechanism for doing this is:
IIRC this has only been tested against shapefiles so your mileage may
vary.
What I currently have in mind for the revised API is to allow
form-encoded parameters for POSTs, where you can include a parameter
'existing=new_table' and the new layer will be created from data already
on the server. I'm not very happy with the parameter name 'existing'
but I think you get the idea.