Can you set a breakpoint in the line
DataStore ds = new PreGeneralizedDataStore(infos,repo)

and inspect the ds object.


Zitat von Zheng Xudong <[email protected]>:

> Well, for the first problem, may be not a problem, I have said something
> wrong. The fact is the pregeneralized shapefile is the same size with each
> other no matter which distance I set, but smaller than the original. So I
> think it simplify the shapefile indeed.
>
> But the second problem still exists. I change the baseFeatureName same as
> the file of shapefile (XXX.shp), and set featureName to "YYY". Then these
> exception were thrown:
>
> java.lang.RuntimeException: java.io.IOException: No such type : YYY
> at
> org.geotools.data.gen.PreGeneralizedFeatureSource.getSupportedHints(PreGeneralizedFeatureSource.java:408)
>  at
> org.geotools.renderer.lite.StreamingRenderer.getLayerQuery(StreamingRenderer.java:1076)
> at
> org.geotools.renderer.lite.StreamingRenderer.processStylers(StreamingRenderer.java:1958)
>  at
> org.geotools.renderer.lite.StreamingRenderer.paint(StreamingRenderer.java:804)
> at org.geotools.swing.RenderingTask.call(RenderingTask.java:106)
>  at org.geotools.swing.RenderingTask.call(RenderingTask.java:41)
> at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:166)
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
>  at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
> at java.lang.Thread.run(Thread.java:722)
>
>
> And I tried orginfo, it seems show the shapefile structure and content for
> me, like that:
>
>     INFO: Open of `XXX.shp'
>           using driver `ESRI Shapefile' successful.
>     Layer name: XXX
>     Geometry: Line String
>     Feature Count: 91634
>     Extent: (115.375000, 39.416667) - (117.500000, 41.083333)
>     Layer SRS WKT:
>     GEOGCS["Lat Long for MAPINFO type 0 Datum ",
>         DATUM["MAPINFO",
>             SPHEROID["World Geodetic System of
> 1984",6378137,298.257222932867]],
>         PRIMEM["Greenwich",0],
>         UNIT["degree",0.0174532925199433]]
>     MAPID: String (8.0)
>     ID: String (13.0)
>     KIND_NUM: String (2.0)
>     KIND: String (23.0)
>     WIDTH: String (3.0)
>     DIRECTION: String (1.0)
>     TOLL: String (1.0)
>     CONST_ST: String (1.0)
>     PATHNAME: String (40.0)
>     PATHPY: String (250.0)
>     SNODEID: String (13.0)
>     ENODEID: String (13.0)
>     PATHCLASS: String (2.0)
>     PATHNO: String (13.0)
>     LENGTH: String (8.0)
>     ONEWAYCRID: String (13.0)
>
>     OGRFeature(XXX):0
>       MAPID (String) = 605751
>       ID (String) = 60575100011
>       KIND_NUM (String) = 1
>       KIND (String) = 0601
>       WIDTH (String) = 55
>       DIRECTION (String) = 0
>       TOLL (String) = 2
>       CONST_ST (String) = 1
>       PATHNAME (String) = Y352
>       PATHPY (String) = y san wu er
>       SNODEID (String) = 60575100013
>       ENODEID (String) = 60575100020
>       PATHCLASS (String) = 2
>       PATHNO (String) = 7431
>       LENGTH (String) = 0.280
>       ONEWAYCRID (String) = (null)
>       LINESTRING : 8 points
>
>     OGRFeature(xxx):1
>       MAPID (String) = 605751
>       ID (String) = 60575100015
>       KIND_NUM (String) = 1
>       KIND (String) = 0601
>       WIDTH (String) = 55
>       DIRECTION (String) = 0
>       TOLL (String) = 2
>       CONST_ST (String) = 1
>       PATHNAME (String) = Y352
>       PATHPY (String) = y san wu er
>       SNODEID (String) = 60575100020
>       ENODEID (String) = 60575100024
>       PATHCLASS (String) = 2
>       PATHNO (String) = 7431
>       LENGTH (String) = 0.305
>       ONEWAYCRID (String) = (null)
>       LINESTRING : 9 points
>
>       ......
>
> and many similar features repeated. Does these would be helpful to solve my
> problem?
>
>
> On Tue, Feb 28, 2012 at 9:01 PM, <[email protected]> wrote:
>
>> Zitat von Zheng Xudong <[email protected]>:
>>
>>  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?
>>>
>>
>> Install the gdal utilities from www.gdal.org. Use
>>
>> ogrinfo -al -geom=SUMMARY xxx.shp
>>
>> to get detailed info.
>>
>>
>>> 2. When I tried to load the pregereralized shapefile following the code in
>>> http://docs.geotools.org/****latest/userguide/library/data/****<http://docs.geotools.org/**latest/userguide/library/data/**>
>>> pregeneralized.html<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 GeneralizationInfosProviderImp
>>> **l();
>>> 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">
>>>
>>
>> This should be something lime
>> <GeneralizationInfo dataSourceName="file:XXX.shp" featureName="YYY"
>>  baseFeatureName="XXX" geomPropertyName="the_geom">
>>
>> YYY is the name you have to use when drawing.
>>
>>     <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.
>>>
>>
>> Again, orginfo is your friend.
>>
>>
>>>
>>> On Mon, Feb 27, 2012 at 11:42 PM, <[email protected]> wrote:
>>>
>>>  You can use
>>>> http://docs.geotools.org/****latest/userguide/library/data/****<http://docs.geotools.org/**latest/userguide/library/data/**>
>>>> pregeneralized.html<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-**<http://docs.geoserver.org/1.7.**5/user/tutorials/feature-**>
>>>> pregeneralized/feature-****pregeneralized_tutorial.html<h**
>>>> ttp://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
>>>
>>>
>>
>>
>> ------------------------------**------------------------------**----
>> 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
>



----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



------------------------------------------------------------------------------
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