On Sat, Apr 28, 2012 at 3:07 PM, André Matos <[email protected]> wrote:

> Hello everyone,
>
> I am new to geotools.
> I came here from geoserver, because I need to made a custom store that
> calls a web service and reads a shapefile to draw the shapes. This custom
> store will be installed in geoserver.
>
>
> While reading the geoserver documentation, I found the following note:
>
> "
>
> Note
>
>
> While GeoServer has robust support for the shapefile format, it is not the
> recommended format of choice in a production environment. Databases such as
> PostGIS are more suitable in production and offer better performance and
> scalability. See the section on *Running in a Production 
> Environment*<http://docs.geoserver.org/latest/en/user/production/index.html#production>
>  for
> more information.
> " (http://docs.geoserver.org/latest/en/user/data/shapefile.html)
>
> At a first glance this note seems to make sense to me. PostGIS will be
> faster than reading a shapefile.... But, in my case must support custom
> shapefiles, e.g. a user can upload a shapefile and then see the a map image
> with the uploaded shapefile.
>
> So, I made some tests. I created 2 layers with the *same data*:
>  - The first layer will load data from PostGIS (with indexes created at
> geographic column)
>  - The second layer will load data from the shapefile.
>
>
> The test conditions are the same for this two test cases. It's all on the
> same computer (PostGIS database, Geoserver and the shapefile).
>
> The result was unexpected. The second layer, reading a shapefile directly
> was faster than reading data from PostGIS database, I read the link
> "Running in a Production Environment" and found no explanation for this...
>

You got the normal result. If all you're trying is to display the whole
dataset the shapefile will be a lot faster
(especially if you turned on prepared statements in postgis, turn it off to
get better read performance).

If you instead try to display only a small portion of a very large layer
(millions of entries), PostGIS should be
a bit faster, and if you have a style that is filtering on attributes and
those attributes are indexed in
PostGIS, then that will be a lot faster.

Write wise there is no comparison, PostGIS should be better both speed and
stability wise by a large margin
(the larger the bigger is the layer in question).

Cheers
Andrea

-- 
-------------------------------------------------------
Ing. Andrea Aime
GeoSolutions S.A.S.
Tech lead

Via Poggio alle Viti 1187
55054  Massarosa (LU)
Italy

phone: +39 0584 962313
fax:      +39 0584 962313
mob:    +39 339 8844549

http://www.geo-solutions.it
http://geo-solutions.blogspot.com/
http://www.youtube.com/user/GeoSolutionsIT
http://www.linkedin.com/in/andreaaime
http://twitter.com/geowolf

-------------------------------------------------------
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to