|
From: Justin D. <jde...@op...> - 2009-07-29 13:06:30
|
Glad you got it to work. And I agree that having to fill in all the information is a but. Can you open a JIRA for it. Pablo José Cabrera Muñoz wrote: > Hi again, > > I've been tinkering with the REST API trying to setup my coverage and it > worked just like you said. But when I restarted the Geoserver, the > coverage was gone... > > Analyzing the log, I found out that it were some missing elements in the > info.xml from the configured coverage. I've put one by one on the XML > package and finally got it working (It remained there after restarting > the Geoserver). > > And here is the final XML that worked: > > String xml = > "<coverage>" + > "<name>Rectifyikonos_mini</name>" + > "<nativeCRS>EPSG:4326</nativeCRS>" + > "<srs>EPSG:4326</srs>" + > "<nativeBoundingBox>" + > "<minx>-47.894287656176694</minx>" + > "<maxx>-47.8472086561767</maxx>" + > "<miny>-15.81370553348783</miny>" + > "<maxy>-15.782511533487831</maxy>" + > "<crs>EPSG:4326</crs>" + > "</nativeBoundingBox>" + > "<latLonBoundingBox>" + > "<minx>-47.894287656176694</minx>" + > "<maxx>-47.8472086561767</maxx>" + > "<miny>-15.81370553348783</miny>" + > "<maxy>-15.782511533487831</maxy>" + > "<crs>EPSG:4326</crs>" + > "</latLonBoundingBox>" + > "<enabled>true</enabled>" + > "<keywords>" + > "<string>WCS</string>" + > "</keywords>" + > "<parameters />" + > "<metadata>" + > "<dirName>brasilia_Rectifyikonos_mini</dirName>" + > "</metadata>" + > "<dimensions>" + > "<coverageDimension>" + > "<name>RED_BAND</name>" + > > "<description>GridSampleDimension[-Infinity,Infinity]</description>" + > "<nullValues/>" + > "</coverageDimension>" + > "<coverageDimension>" + > "<name>GREEN_BAND</name>" + > > "<description>GridSampleDimension[-Infinity,Infinity]</description>" + > "<nullValues/>" + > "</coverageDimension>" + > "<coverageDimension>" + > "<name>BLUE_BAND</name>" + > > "<description>GridSampleDimension[-Infinity,Infinity]</description>" + > "<nullValues/>" + > "</coverageDimension>" + > "</dimensions>" + > "<supportedFormats>" + > "<string>ARCGRID</string>" + > "<string>GTOPO30</string>" + > "<string>IMAGEMOSAIC</string>" + > "<string>GEOTIFF</string>" + > "<string>GIF</string>" + > "<string>PNG</string>" + > "<string>JPEG</string>" + > "<string>TIFF</string>" + > "</supportedFormats>" + > "<nativeFormat>WorldImage</nativeFormat>"+ > "<interpolationMethods>" + > "<string>nearest neighbor</string>" + > "<string>bilinear</string>" + > "<string>bicubic</string>" + > "</interpolationMethods>" + > > "<defaultInterpolationMethod>bicubic</defaultInterpolationMethod>" + > "<requestSRS>" + > "<string>EPSG:4326</string>" + > "</requestSRS>" + > "<responseSRS>" + > "<string>EPSG:4326</string>" + > "</responseSRS>" + > "<grid dimension=\"2\">" + > "<range>" + > "<low>0 0</low>" + > "<high>5231 3466</high>" + > "</range>" + > "<transform>" + > "<scaleX>8.999999999999338E-6</scaleX>" + > "<scaleY>-8.999999999999792E-6</scaleY>" + > "<shearX>0.0</shearX>" + > "<shearX>0.0</shearX>" + > "<translateX>-47.89428315617669</translateX>" + > "<translateY>-15.78251603348783</translateY>" + > "</transform>" + > "<crs>EPSG:4326</crs>" + > "</grid>" + > "</coverage>"; > > Essentially I had to pass the complete coverage data so it could be > saved properly, and to do so I had to read the image file anyway. Like > this there isn't much point in in, since the idea was to avoid the big > file upload. :-( > > Pablo José Cabrera Muñoz wrote: >> Good morning, >> >> I tried with this XML: >> >> String xml = >> "<coverage>" + >> "<name>Rectifyikonos_mini</name>" + >> "<nativeCRS>EPSG:4326</nativeCRS>" + >> "<srs>EPSG:4326</srs>" + >> "<nativeBoundingBox>" + >> "<minx>-47.894287656176694</minx>" + >> "<maxx>-47.8472086561767</maxx>" + >> "<miny>-15.81370553348783</miny>" + >> "<maxy>-15.782511533487831</maxy>" + >> "<crs>EPSG:4326</crs>" + >> "</nativeBoundingBox>" + >> "<latLonBoundingBox>" + >> "<minx>-47.894287656176694</minx>" + >> "<maxx>-47.8472086561767</maxx>" + >> "<miny>-15.81370553348783</miny>" + >> "<maxy>-15.782511533487831</maxy>" + >> "<crs>EPSG:4326</crs>" + >> "</latLonBoundingBox>" + >> "<enabled>true</enabled>" + >> "<metadata>" + >> "<dirName>brasilia_Rectifyikonos_mini</dirName>" + >> "</metadata>" + >> "<dimensions>" + >> "<coverageDimension>" + >> "<name>RED_BAND</name>" + >> >> "<description>GridSampleDimension[-Infinity,Infinity]</description>" + >> "</coverageDimension>" + >> "<coverageDimension>" + >> "<name>GREEN_BAND</name>" + >> >> "<description>GridSampleDimension[-Infinity,Infinity]</description>" + >> "</coverageDimension>" + >> "<coverageDimension>" + >> "<name>BLUE_BAND</name>" + >> >> "<description>GridSampleDimension[-Infinity,Infinity]</description>" + >> "</coverageDimension>" + >> "</dimensions>" + >> "</coverage>"; >> >> ... and here is the exception that I got from the geoserver log while >> trying to POST it: >> >> Caused by: java.lang.NullPointerException >> at >> org.vfny.geoserver.global.CoverageDimension.getNullValues(CoverageDimension.java:95) >> at >> org.vfny.geoserver.global.xml.XMLConfigWriter.storeCoverage(XMLConfigWriter.java:1667) >> at >> org.vfny.geoserver.global.xml.XMLConfigWriter.storeCoverages(XMLConfigWriter.java:1458) >> at >> org.vfny.geoserver.global.xml.XMLConfigWriter.store(XMLConfigWriter.java:125) >> at >> org.geoserver.catalog.rest.CatalogResourceBase.saveCatalog(CatalogResourceBase.java:79) >> at >> org.geoserver.catalog.rest.CatalogResourceBase.saveCatalog(CatalogResourceBase.java:68) >> at >> org.geoserver.catalog.rest.CoverageResource.handleObjectPost(CoverageResource.java:89) >> at >> org.geoserver.rest.ReflectiveResource.handlePost(ReflectiveResource.java:115) >> ... 56 more >> >> Is there anything wrong with the dimension? I just copied the one >> generated from the REST interface itself. >> >> By the way, I had to put the <metadata><dirName> to avoid yet another >> NullPointerException... >> >> Pablo >> >> PS.: I'm Fernando's colleague, by the way... >> >> Justin Deoliveira wrote: >>> Hi Fernando, >>> >>> So I tried this out, and basically here are the steps. >>> >>> First you create the coverage store. POSTing some xml like this: >>> >>> <coverageStore> >>> <name>newCoverageStore</name> >>> <enabled>true</enabled> >>> <type>GeoTIFF</type> >>> <url>file:coverages/some_dir/some_file.tiff</url> >>> </coverageStore> >>> >>> Next you need to create the coverage. Now it appears that you have to >>> specify much of the metadata, including: >>> >>> srs >>> nativeCRS >>> nativeBoundingBox >>> latLonBoundingBox >>> dimensions >>> >>> So POSTing something like: >>> >>> <coverage> >>> <name>newCoverage</name> >>> <srs>EPSG:4326</srs> >>> <nativeCRS>EPSG:4326</nativeCRS> >>> <nativeBoundingBox> >>> <minx>146.49999999999477</minx> >>> <miny>-44.49999999999785</miny> >>> <maxx>147.99999999999474</maxx> >>> <maxy>-42.99999999999787</maxy> >>> <crs>EPSG:4326</crs> >>> </nativeBoundingBox> >>> <latLonBoundingBox> >>> <minx>146.49999999999477</minx> >>> <miny>-44.49999999999785</miny> >>> <maxx>147.99999999999474</maxx> >>> <maxy>-42.99999999999787</maxy> >>> <crs>EPSG:4326</crs> >>> </latLonBoundingBox> >>> <dimensions> >>> <coverageDimension> >>> <name>Red band</name> >>> <description>GridSampleDimension[0.0,255.0]</description> >>> <range> >>> <min>0.0</min> >>> <max>255.0</max> >>> </range> >>> </coverageDimension> >>> <coverageDimension> >>> <name>Green band</name> >>> <description>GridSampleDimension[0.0,255.0]</description> >>> <range> >>> <min>0.0</min> >>> <max>255.0</max> >>> </range> >>> </coverageDimension> >>> <coverageDimension> >>> <name>Blue band</name> >>> <description>GridSampleDimension[0.0,255.0]</description> >>> <range> >>> <min>0.0</min> >>> <max>255.0</max> >>> </range> >>> </coverageDimension> >>> </dimensions> >>> >>> </coverage> >>> >>> This is pretty verbose. We should file a jira improvement to have the >>> rest extension auto-configure properties when they are not specified. >>> Like it goes when you upload via a zip file. >>> >>> Hope that helps. >>> >>> -Justin >>> >>> >>> Fernando Quadro wrote: >>> >>>> Mon, 27 Jul 2009 16:06:47 -0400, Justin Deoliveira <jde...@op...> escreveu: >>>> >>>> >>>>> Hi Fernando, >>>>> >>>>> A couple of questions: >>>>> >>>>> Fernando Quadro wrote: >>>>> >>>>>> Hey, >>>>>> >>>>>> We're trying to add a coverage through the GeoServer API REST, but so far we've been able only to add the CoverageStore. >>>>>> >>>>> I take it you are not uploading zipped coverages stores, but "manually" >>>>> creating a coverage store by POSTing to: >>>>> >>>>> http://.../rest/workspaces/<ws>/coveragestores >>>>> >>>>> ? >>>>> >>>> Yes >>>> >>>> >>>>>> The thing is that we already have the image files within the server, but we dont know how to configure them on the geoserver through the REST API. We dont know what is the proper XML format (and wich data to send) that the geoserver expect us to send... >>>>>> >>>>> When you say the image files are already on the server do you mean they >>>>> are on the file system of the server running geoserver, or that they are >>>>> already in the geoserver data directory? >>>>> >>>> Exactly, we have the files under "<DATA_DIR>/coverages/some_dir", and we'd like to configure the coverage using the files under this directory, is there a way? >>>> >>>> Do I need to know every data from the files inside the directory before hand or will the geoserver read them for me (data like srs, gridcoverage, dimensons etc), I mean, should I post all these data within my xml REST package or will the geoserver API read them for me when configuring the coverage? >>>> >>>> >>>>>> Could you help us out please? >>>>>> >>>>> Hopefully with some more info I can help. It would also help if you >>>>> could send me the requests you are issuing to your server. And also any >>>>> errors that are occurring. Ensure that you have logging set to >>>>> GEOSERVER_DEVELOPER_LOGGING. >>>>> >>>> Will do. >>>> >>>> Fernando >>>> >>>> >>>>> -Justin >>>>> >>>>>> Best Regards, >>>>>> >>>>>> Fernando >>>>>> >>>>>> ------------------------------------------------------------------------------ >>>>>> _______________________________________________ >>>>>> Geoserver-users mailing list >>>>>> Geo...@li... >>>>>> https://lists.sourceforge.net/lists/listinfo/geoserver-users >>>>>> >>>>> -- >>>>> Justin Deoliveira >>>>> OpenGeo - http://opengeo.org >>>>> Enterprise support for open source geospatial. >>>>> >>>>> >>>>> >>>>> >>>>> >>> >>> >>> >> ------------------------------------------------------------------------ >> >> ------------------------------------------------------------------------------ >> Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day >> trial. Simplify your report design, integration and deployment - and focus on >> what you do best, core application coding. Discover what's new with >> Crystal Reports now. http://p.sf.net/sfu/bobj-july >> ------------------------------------------------------------------------ >> >> _______________________________________________ >> Geoserver-users mailing list >> Geo...@li... >> https://lists.sourceforge.net/lists/listinfo/geoserver-users >> > > > -- > Pablo Cabrera > Analista Implementador > Softplan/Poligraph > Fone: (048) 3027.8000 > http://www.softplan.com.br > Sistema da Qualidade Certificado ISO 9001:2000 > -- Justin Deoliveira OpenGeo - http://opengeo.org Enterprise support for open source geospatial. |