HomeBlogBooksProjectsArchiveAboutlogo

A Curious Animal

Born to be curious, born to be animal!

Generating map tiles without a map server. GeoTools the GIS swissknife.

23 July, 2011
- 6 min read

Recently I was playing with latest version of GeoServer. It includes the GeoWebCache, something which can improve your server performance greatly. GeoServer solves and helps lots of problems to work and visualize geospatial data but as you know map servers lakes from scalability. // Get lightning store DataStore dataStore = DataStoreFinder.getDataStore(params); SimpleFeatureSource sfs = dataStore.getFeatureSource("lightnings"); // Style for Positivos Graphic grP = styleFactory.createDefaultGraphic(); Mark markP = styleFactory.getCircleMark(); markP.setStroke(styleFactory.createStroke(filterFactory.literal(Color.BLUE), filterFactory.literal(1))); markP.setFill(styleFactory.createFill(filterFactory.literal(Color.CYAN))); grP.graphicalSymbols().clear(); grP.graphicalSymbols().add(markP); grP.setSize(filterFactory.literal(5)); // Style for Negativos Graphic grN = styleFactory.createDefaultGraphic(); Mark markN = styleFactory.getCircleMark(); markN.setStroke(styleFactory.createStroke(filterFactory.literal(Color.RED), filterFactory.literal(1))); markN.setFill(styleFactory.createFill(filterFactory.literal(Color.ORANGE))); grN.graphicalSymbols().clear(); grN.graphicalSymbols().add(markN); grN.setSize(filterFactory.literal(5)); Filter filterPositiveValor = ff.and(filter, CQL.toFilter("value >= 0")); Filter filterNegativeValor = ff.and(filter, CQL.toFilter("value < 0")); // Create symbols and rules to render every feature PointSymbolizer symPositivos = styleFactory.createPointSymbolizer(grP, null); PointSymbolizer symNegativos = styleFactory.createPointSymbolizer(grN, null); Rule ruleP = styleFactory.createRule(); ruleP.symbolizers().add(symPositivos); ruleP.setFilter(filterPositiveValor); FeatureTypeStyle ftsP = styleFactory.createFeatureTypeStyle(new Rule[]{ruleP}); Rule ruleN = styleFactory.createRule(); ruleN.symbolizers().add(symNegativos); ruleN.setFilter(filterNegativeValor); FeatureTypeStyle ftsN = styleFactory.createFeatureTypeStyle(new Rule[]{ruleN}); // Finally create out style Style style = styleFactory.createStyle(); style.featureTypeStyles().add(ftsP); style.featureTypeStyles().add(ftsN); }