I tried the PreGeneralized following the two link, but I encounter two odd
problems:

1. I found the pregeneralized shapefile is still the same size with the
original, no matter which distance I set. Why? Does it means the
pregeneralization method is not suitable for my shapefile?

2. When I tried to load the pregereralized shapefile following the code in
http://docs.geotools.org/**latest/userguide/library/data/**
pregeneralized.html<http://docs.geotools.org/latest/userguide/library/data/pregeneralized.html>,
like:


Repository repo = new RepositoryDSFinder();
GeneralizationInfosProvider provider = new GeneralizationInfosProviderImpl();
GeneralizationInfos infos = null;
try {
  infos = provider.getGeneralizationInfos("map_info.xml");
} catch (IOException e) {
  e.printStackTrace();
}
DataStore ds = new PreGeneralizedDataStore(infos,repo)
FeatureSource<SimpleFeatureType, SimpleFeature> fs = ds.getFeatureSource("XXX")

and the map_info.xml is like:

<?xml version="1.0" encoding="UTF-8"?>
<GeneralizationInfos version="1.0">
  <GeneralizationInfo dataSourceName="file:XXX.shp" featureName="XXX"
baseFeatureName="XXX" geomPropertyName="the_geom">
    <Generalization dataSourceName="file:map/5.0/XXX.shp" distance="5"
featureName="XXX" geomPropertyName="the_geom"/>
    <Generalization dataSourceName="file:map/10.0/XXX.shp"
distance="10" featureName="XXX" geomPropertyName="the_geom"/>
    <Generalization dataSourceName="file:map/20.0/XXX.shp"
distance="20" featureName="XXX" geomPropertyName="the_geom"/>
  </GeneralizationInfo>
</GeneralizationInfos>

the "XXX" is the filename of my shapefile.

But when I invoke *fs.getSchema()*, it prompt "No such type : XXX". I
suspect whether the featureName is set wrong, but I don't know how could I
get the featureName or baseFeatureName in my shapefile.


On Mon, Feb 27, 2012 at 11:42 PM, <[email protected]> wrote:

> You can use
> http://docs.geotools.org/**latest/userguide/library/data/**
> pregeneralized.html<http://docs.geotools.org/latest/userguide/library/data/pregeneralized.html>
>
> A tutorial using shape files is here
> http://docs.geoserver.org/1.7.**5/user/tutorials/feature-**
> pregeneralized/feature-**pregeneralized_tutorial.html<http://docs.geoserver.org/1.7.5/user/tutorials/feature-pregeneralized/feature-pregeneralized_tutorial.html>
>
> I would recommend using a spatial database like postgis, using shape files
> has the disadvantage of duplicating all non geometry attributes for each
> level.
>
> Christian
>
>
> Zitat von Zheng Xudong <[email protected]>:
>
>
>  Hi all,
>>
>>    I use GeoTools 8.0M4 to load a shapefile contains about 10,000+
>>  geometries (each is a multiline). The code is just like the demo in
>> quickstart. But I found the rendering is a little slow, especially when I
>> zoom in/out or drag the map, and even sometimes the rendering couldn't
>> completed (leave some blank area).  What can I do to optimize the
>> performance of rendering, or the demo is already the best solution? The
>> CPU
>> of my PC is Core Duo E6550, the memory is 2G, and the graphics card is ATI
>> Radeon HD 2400.
>>
>>    Thanks and best regards!
>>
>> --
>> Zheng Xudong
>> State Key Laboratory of Software Development Environment
>> School of Computer Science and Engineer, BeiHang University
>>
>>
>
>
> ------------------------------**------------------------------**----
> This message was sent using IMP, the Internet Messaging Program.
>
>
> --
Zheng Xudong
State Key Laboratory of Software Development Environment
School of Computer Science and Engineer, BeiHang University
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
GeoTools-GT2-Users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-gt2-users

Reply via email to