You may also consider using the resource rest api to upload the file, and
the the importer rest api in ingest (it offers greater control as Ian
suggests).

The upload you found determines a unique table name based on the provided
content, so for your shapefile this is based on the filename.

The file is here
https://github.com/geoserver/geoserver/blob/main/src/restconfig/src/main/java/org/geoserver/rest/catalog/DataStoreFileController.java
if
you wish to troubleshoot.

                    // does the feature type already exist in the target?
                    try {
                        targetDataStore.getSchema(featureTypeName);
                    } catch (Exception e) {
                        LOGGER.info(
                                featureTypeName
                                        + " does not exist in data store "
                                        + storeName
                                        + ". Attempting to create it");

                        // schema does not exist, create it by first
creating an instance
                        // of the source datastore and copying over its
schema

targetDataStore.createSchema(sourceDataStore.getSchema(featureTypeName));
                        sourceDataStore.getSchema(featureTypeName);
                    }

--
Jody Garnett


On May 9, 2022 at 10:34:22 AM, Giuseppe Falcone <falcone.giuse...@gmail.com>
wrote:

> Hi
> thanks for the response.
> I'm building a web application that must have this function.
> From browser user upload a shapefile e I put into a db table.
> I think REST API are perfect for this purpose.
>
> Giuseppe
>
> Il giorno lun 9 mag 2022 alle ore 19:22 Ian Turton <ijtur...@gmail.com>
> ha scritto:
>
>> I'm not sure that you need to involve geoserver in this, Ogr2ogr would be
>> quicker and easier to append a shapefile to a database. The GeoServer rest
>> api is for creating data stores and layers etc not individual data
>> management.
>>
>> Alternatively you might be able to use the importer extension to do this
>> but I've not used that in anger
>>
>>
>> Ian
>>
>> On Mon, 9 May 2022, 17:25 Giuseppe Falcone, <falcone.giuse...@gmail.com>
>> wrote:
>>
>>> Hi to all
>>> I want with geoserver REST API put a shapefile into an existing postgis
>>> table.
>>> I know how to load a shapefile into a postgis database, but I don't know
>>> how I could indicate a specific table in which append data.
>>> I Have a shapefile named tableA.shp; it's possible put it's data into a
>>> postgis table named tableB?
>>> Thanks a lot
>>>
>>> Giuseppe
>>>
>>> _______________________________________________
>>> 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
>>>
>> _______________________________________________
> 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
>
_______________________________________________
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