View Javadoc
1   /*******************************************************************************
2    *   Gisgraphy Project 
3    * 
4    *   This library is free software; you can redistribute it and/or
5    *   modify it under the terms of the GNU Lesser General Public
6    *   License as published by the Free Software Foundation; either
7    *   version 2.1 of the License, or (at your option) any later version.
8    * 
9    *   This library is distributed in the hope that it will be useful,
10   *   but WITHOUT ANY WARRANTY; without even the implied warranty of
11   *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12   *   Lesser General Public License for more details.
13   * 
14   *   You should have received a copy of the GNU Lesser General Public
15   *   License along with this library; if not, write to the Free Software
16   *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
17   * 
18   *  Copyright 2008  Gisgraphy project 
19   *  David Masclet <davidmasclet@gisgraphy.com>
20   *  
21   *  
22   *******************************************************************************/
23  package com.gisgraphy.importer;
24  
25  import java.util.ArrayList;
26  import java.util.Arrays;
27  import java.util.HashSet;
28  import java.util.List;
29  import java.util.Set;
30  
31  import com.gisgraphy.domain.geoloc.entity.ATM;
32  import com.gisgraphy.domain.geoloc.entity.AdmBuilding;
33  import com.gisgraphy.domain.geoloc.entity.Airport;
34  import com.gisgraphy.domain.geoloc.entity.AmusePark;
35  import com.gisgraphy.domain.geoloc.entity.Bank;
36  import com.gisgraphy.domain.geoloc.entity.Bar;
37  import com.gisgraphy.domain.geoloc.entity.Bench;
38  import com.gisgraphy.domain.geoloc.entity.BusStation;
39  import com.gisgraphy.domain.geoloc.entity.Camping;
40  import com.gisgraphy.domain.geoloc.entity.Casino;
41  import com.gisgraphy.domain.geoloc.entity.Castle;
42  import com.gisgraphy.domain.geoloc.entity.Cemetery;
43  import com.gisgraphy.domain.geoloc.entity.Cinema;
44  import com.gisgraphy.domain.geoloc.entity.CityHall;
45  import com.gisgraphy.domain.geoloc.entity.CourtHouse;
46  import com.gisgraphy.domain.geoloc.entity.Craft;
47  import com.gisgraphy.domain.geoloc.entity.Dentist;
48  import com.gisgraphy.domain.geoloc.entity.Doctor;
49  import com.gisgraphy.domain.geoloc.entity.EmergencyPhone;
50  import com.gisgraphy.domain.geoloc.entity.Farm;
51  import com.gisgraphy.domain.geoloc.entity.FerryTerminal;
52  import com.gisgraphy.domain.geoloc.entity.FireStation;
53  import com.gisgraphy.domain.geoloc.entity.FishingArea;
54  import com.gisgraphy.domain.geoloc.entity.Fountain;
55  import com.gisgraphy.domain.geoloc.entity.Fuel;
56  import com.gisgraphy.domain.geoloc.entity.Garden;
57  import com.gisgraphy.domain.geoloc.entity.GisFeature;
58  import com.gisgraphy.domain.geoloc.entity.Golf;
59  import com.gisgraphy.domain.geoloc.entity.Hospital;
60  import com.gisgraphy.domain.geoloc.entity.Hotel;
61  import com.gisgraphy.domain.geoloc.entity.House;
62  import com.gisgraphy.domain.geoloc.entity.Ice;
63  import com.gisgraphy.domain.geoloc.entity.Library;
64  import com.gisgraphy.domain.geoloc.entity.Mill;
65  import com.gisgraphy.domain.geoloc.entity.Museum;
66  import com.gisgraphy.domain.geoloc.entity.NightClub;
67  import com.gisgraphy.domain.geoloc.entity.ObservatoryPoint;
68  import com.gisgraphy.domain.geoloc.entity.Park;
69  import com.gisgraphy.domain.geoloc.entity.Parking;
70  import com.gisgraphy.domain.geoloc.entity.Pharmacy;
71  import com.gisgraphy.domain.geoloc.entity.Picnic;
72  import com.gisgraphy.domain.geoloc.entity.PolicePost;
73  import com.gisgraphy.domain.geoloc.entity.Port;
74  import com.gisgraphy.domain.geoloc.entity.PostOffice;
75  import com.gisgraphy.domain.geoloc.entity.Prison;
76  import com.gisgraphy.domain.geoloc.entity.Rail;
77  import com.gisgraphy.domain.geoloc.entity.RailRoadStation;
78  import com.gisgraphy.domain.geoloc.entity.Religious;
79  import com.gisgraphy.domain.geoloc.entity.Rental;
80  import com.gisgraphy.domain.geoloc.entity.Reserve;
81  import com.gisgraphy.domain.geoloc.entity.Restaurant;
82  import com.gisgraphy.domain.geoloc.entity.School;
83  import com.gisgraphy.domain.geoloc.entity.Shop;
84  import com.gisgraphy.domain.geoloc.entity.Sport;
85  import com.gisgraphy.domain.geoloc.entity.Stadium;
86  import com.gisgraphy.domain.geoloc.entity.SwimmingPool;
87  import com.gisgraphy.domain.geoloc.entity.Taxi;
88  import com.gisgraphy.domain.geoloc.entity.Telephone;
89  import com.gisgraphy.domain.geoloc.entity.Theater;
90  import com.gisgraphy.domain.geoloc.entity.Toilet;
91  import com.gisgraphy.domain.geoloc.entity.Tourism;
92  import com.gisgraphy.domain.geoloc.entity.TourismInfo;
93  import com.gisgraphy.domain.geoloc.entity.VendingMachine;
94  import com.gisgraphy.domain.geoloc.entity.Veterinary;
95  import com.gisgraphy.domain.geoloc.entity.Zoo;
96  
97  
98  /**
99   * associates the amenity tag of osm to a palcetype. 
100  * list of values based on http://taginfo.openstreetmap.org/keys/?key=amenity#values
101  * 
102  * 
103  * @author <a href="mailto:david.masclet@gisgraphy.com">David Masclet</a>
104  */
105 public class OsmAmenityToPlacetype {
106 
107 	public static int TAGS_ARRAY_SIZE = 14;
108 
109 	public final static String  DEFAULT_OSM_FEATURE_CODE= "UNK";
110 	public final static String  DEFAULT_OSM_FEATURE_CLASS= "UNK";
111 	
112 	boolean isNonRealTag(String tag) {
113 		if (tag == null || "".equals(tag.trim()) || "yes".equalsIgnoreCase(tag) ||  "no".equalsIgnoreCase(tag)  ||  "fixme".equalsIgnoreCase(tag) ){
114 			return true;
115 		} 
116 		return false;
117 	}
118 
119 	public List<GisFeature> getObjectsFromTags(String[] tags){
120 		List<GisFeature> objects = new ArrayList<GisFeature>();
121 		if (tags == null){
122 			return objects;
123 		}
124 		if (tags.length!= TAGS_ARRAY_SIZE){
125 			throw new RuntimeException("tags array has not the correct size expected "+TAGS_ARRAY_SIZE+" but was "+tags.length+" :" +Arrays.toString(tags));//pqp
126 		}
127 		//0: amenity, 1: aeroway,2 : building,3: craft, 4 : historic, 5: leisure,6 : man_made,7 : office, 8 : railway,9 :tourism,10 : shop,11 : sport,12 :landuse,13 : highway
128 		GisFeature o = getRailwayObject(tags[8]);
129 		if (o!=null){
130 			objects.add(o);
131 			return objects;//railway is only a railway pqp
132 		}
133 		o = getAerowayObject(tags[1]);
134 		if (o!=null){
135 			objects.add(o);
136 			return objects;//aeroway is only a railway pqp
137 		}
138 		Set<String> placeTypes = new HashSet<String>();
139 		o = getAmenityObject(tags[0]);
140 		if (o!=null){
141 			objects.add(o);
142 			placeTypes.add(o.getClass().getSimpleName());
143 		}
144 		o = getBuildingObject(tags[2]);
145 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
146 			objects.add(o);
147 			placeTypes.add(o.getClass().getSimpleName());
148 		}
149 		o = getCraftObject(tags[3]);
150 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
151 			objects.add(o);
152 			placeTypes.add(o.getClass().getSimpleName());
153 		}
154 		o = getHistoricObject(tags[4]);
155 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
156 			objects.add(o);
157 			placeTypes.add(o.getClass().getSimpleName());
158 		}
159 		//if leisure and !sport or !sport[pitch|sports_center]
160 		if (tags[5]!=null && 
161 				(tags[12]==null ||
162 				(tags[12]!=null && !("pitch".equals(tags[5].trim().toLowerCase()) || "sports_center".equals(tags[5].trim().toLowerCase())))
163 				)
164 			){
165 			o = getLeisureObject(tags[5]);
166 			if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
167 				objects.add(o);
168 				placeTypes.add(o.getClass().getSimpleName());
169 			}
170 		}
171 		o = getManMadeObject(tags[6]);
172 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
173 			objects.add(o);
174 			placeTypes.add(o.getClass().getSimpleName());
175 		}
176 		o = getOfficeObject(tags[7]);
177 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
178 			objects.add(o);
179 			placeTypes.add(o.getClass().getSimpleName());
180 		}
181 		o = getTourismObject(tags[9]);
182 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
183 			objects.add(o);
184 			placeTypes.add(o.getClass().getSimpleName());
185 		}
186 		o = getShopObject(tags[10]);
187 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
188 			objects.add(o);
189 			placeTypes.add(o.getClass().getSimpleName());
190 		}
191 		o = getSportObject(tags[11]);
192 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
193 			objects.add(o);
194 			placeTypes.add(o.getClass().getSimpleName());
195 		}
196 		o = getLanduseObject(tags[12]);
197 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
198 			objects.add(o);
199 			placeTypes.add(o.getClass().getSimpleName());
200 		}
201 		o = getHighwayObject(tags[13]);
202 		if (o!=null && !placeTypes.contains(o.getClass().getSimpleName())){
203 			objects.add(o);
204 			placeTypes.add(o.getClass().getSimpleName());
205 		}
206 
207         if (objects.size()==0){
208         	objects.add(new GisFeature());
209         }
210 		return objects;
211 	}
212 
213 
214 
215 	GisFeature getAmenityObject(String amenity){
216 		if (isNonRealTag(amenity)){
217 			return null;
218 		} 
219 		GisFeature gisfeature = null;
220 		//take care of case, always put in lower case
221 		String a = amenity.trim().toLowerCase();
222 		if ("parking".equals(a)){
223 			gisfeature =  new Parking();
224 		} else if ("school".equals(a)){
225 			gisfeature =  new School();
226 		} else  if ("place_of_worship".equals(a)){
227 			gisfeature =  new Religious();
228 		} else  if ("restaurant".equals(a)){
229 			gisfeature =  new Restaurant();
230 		} else  if ("fuel".equals(a)){
231 			gisfeature =  new Fuel();
232 		} else  if ("bench".equals(a)){
233 			gisfeature =  new Bench();
234 		} else  if ("grave_yard".equals(a)){
235 			gisfeature =  new Cemetery();
236 		} else  if ("post_box".equals(a)){
237 			gisfeature =  new PostOffice();
238 		} else  if ("bank".equals(a)){
239 			gisfeature =  new Bank();
240 		} else  if ("fast_food".equals(a)){
241 			gisfeature =  new Restaurant();
242 		} else  if ("cafe".equals(a)){
243 			gisfeature =  new Restaurant();
244 		} else  if ("kindergarten".equals(a)){
245 			gisfeature =  new School();
246 		} else  if ("hospital".equals(a)){
247 			gisfeature =  new Hospital();
248 		} else  if ("pharmacy".equals(a)){
249 			gisfeature =  new Pharmacy();
250 		} else  if ("post_office".equals(a)){
251 			gisfeature =  new PostOffice();
252 		} else  if ("pub".equals(a)){
253 			gisfeature =  new Bar();
254 		} else  if ("bicycle_parking".equals(a)){
255 			gisfeature =  new Parking();
256 		} else  if ("telephone".equals(a)){
257 			gisfeature =  new Telephone();
258 		} else  if ("toilets".equals(a)){
259 			gisfeature =  new Toilet();
260 		}  else  if ("atm".equals(a)){
261 			gisfeature =  new ATM();
262 		} else  if ("drinking_water".equals(a)){
263 			gisfeature =  new GisFeature();
264 		} else  if ("fire_station".equals(a)){
265 			gisfeature =  new FireStation();
266 		} else  if ("police".equals(a)){
267 			gisfeature =  new PolicePost();
268 		} else  if ("bar".equals(a)){
269 			gisfeature =  new Bar();
270 		} else  if ("swimming_pool".equals(a)){
271 			gisfeature =  new SwimmingPool();
272 		} else  if ("townhall".equals(a)){
273 			gisfeature =  new CityHall();
274 		} else  if ("parking_space".equals(a)){
275 			gisfeature =  new Parking();
276 		} else  if ("library".equals(a)){
277 			gisfeature =  new Library();
278 		} else  if ("fountain".equals(a)){
279 			gisfeature =  new Fountain();
280 		} else  if ("vending_machine".equals(a)){
281 			gisfeature =  new VendingMachine();
282 		} else  if ("university".equals(a)){
283 			gisfeature =  new School();
284 		} else  if ("doctors".equals(a)){
285 			gisfeature =  new Doctor();
286 		} else  if ("social_facility".equals(a)){
287 			gisfeature =  new AdmBuilding();
288 		} else  if ("bus_station".equals(a)){
289 			gisfeature =  new BusStation();
290 		} else  if ("college".equals(a)){
291 			gisfeature =  new School();
292 		} else  if ("car_wash".equals(a)){
293 			gisfeature =  new GisFeature();
294 		} else  if ("marketplace".equals(a)){
295 			gisfeature =  new Shop();
296 		} else  if ("emergency_phone".equals(a)){
297 			gisfeature =  new EmergencyPhone();
298 		} else  if ("dentist".equals(a)){
299 			gisfeature =  new Dentist();
300 		} else  if ("theatre".equals(a)){
301 			gisfeature =  new Theater();
302 		} else  if ("taxi".equals(a)){
303 			gisfeature =  new Taxi();
304 		} else  if ("community_centre".equals(a)){
305 			gisfeature =  new GisFeature();
306 		} else  if ("cinema".equals(a)){
307 			gisfeature =  new Cinema();
308 		} else  if ("fire_hydrant".equals(a)){
309 			gisfeature =  new FireStation();
310 		} else  if ("bicycle_rental".equals(a)){
311 			gisfeature =  new Rental();
312 		} else  if ("veterinary".equals(a)){
313 			gisfeature =  new Veterinary();
314 		} else  if ("residential".equals(a)){
315 			gisfeature =  new House();
316 		} else  if ("nursing_home".equals(a)){
317 			gisfeature =  new House();
318 		} else  if ("courthouse".equals(a)){
319 			gisfeature =  new CourtHouse();
320 		} else  if ("ferry_terminal".equals(a)){
321 			gisfeature =  new FerryTerminal();
322 		} else  if ("nightclub".equals(a)){
323 			gisfeature =  new NightClub();
324 		}  else  if ("arts_centre".equals(a)){
325 			gisfeature =  new Museum();
326 		} else  if ("bbq".equals(a)){
327 			gisfeature =  new GisFeature();
328 		} else  if ("parking_entrance".equals(a)){
329 			gisfeature =  new Parking();
330 		}  else  if ("biergarten".equals(a)){
331 			gisfeature =  new Bar();
332 		} else  if ("car_rental".equals(a)){
333 			gisfeature =  new Rental();
334 		}  else  if ("clinic".equals(a)){
335 			gisfeature =  new Hospital();
336 		}  else  if ("prison".equals(a)){
337 			gisfeature =  new Prison();
338 		}  else  if ("car_sharing".equals(a)){
339 			gisfeature =  new Rental();
340 		}  else  if ("embassy".equals(a)){
341 			gisfeature =  new AdmBuilding();
342 		}  else  if ("driving_school".equals(a)){
343 			gisfeature =  new Shop();
344 		}  else  if ("ice_cream".equals(a)){
345 			gisfeature =  new Restaurant();
346 		}  else  if ("clock".equals(a)){
347 			gisfeature =  new GisFeature();
348 		}  else  if ("charging_station".equals(a)){
349 			gisfeature =  new GisFeature();
350 		}  else  if ("bureau_de_change".equals(a)){
351 			gisfeature =  new ATM();
352 		} else  if ("parking;fuel".equals(a)){
353 			gisfeature =  new Parking();
354 		} else  if ("shop".equals(a)){
355 			gisfeature =  new Shop();
356 		} else  if ("motorcycle_parking".equals(a)){
357 			gisfeature =  new Parking();
358 		} else  if ("casino".equals(a)){
359 			gisfeature =  new Casino();
360 		} else  if ("bus_stop".equals(a)){
361 			gisfeature =  new BusStation();
362 		}else  if ("monastery".equals(a)){
363 			gisfeature =  new Religious();
364 		}
365 		//tag we want to ignore
366 		else  if ("public_building".equals(a)){
367 			return null;
368 		}  else  if ("building".equals(a)){
369 			return null;
370 		} else  if ("no".equals(a)){
371 			return null;
372 		} else  if ("yes".equals(a)){
373 			return null;
374 		} else  if ("fixme".equals(a)){
375 			return null;
376 		}else  if ("recycling".equals(a)){
377 			return null;
378 		} else  if ("waste_basket".equals(a)){//bin
379 			return null;
380 		} else  if ("shelter".equals(a)){//abris
381 			return null;
382 		} else  if ("grit_bin".equals(a)){//composteur
383 			return null;
384 		} else  if ("waste_disposal".equals(a)){
385 			return null;
386 		}
387 		//default if we don't know (should we kepp the poi and it let us the ability to search by amenity,
388 		//or should we consider that it is something exotic
389 		else {
390 			/*gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
391 			gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
392 			gisfeature =  new GisFeature();*/
393 			return null;
394 		}
395 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
396 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
397 		gisfeature.setAmenity(a);
398 		return gisfeature;
399 	}
400 
401 
402 	GisFeature getAerowayObject(String aeroway){
403 		//default to airport
404 		if (isNonRealTag(aeroway)){
405 			return null;
406 		} 
407 		GisFeature gisfeature =  new Airport();
408 		String a  = aeroway.trim().toLowerCase();
409 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
410 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
411 		gisfeature.setAmenity(a);
412 		return gisfeature;
413 
414 	}
415 
416 
417 	GisFeature getRailwayObject(String railway){
418 		//default to rail
419 		String a = null;
420 		if (isNonRealTag(railway)){
421 			return null;
422 		} 
423 		GisFeature gisfeature = new Rail();
424 		a = railway.trim().toLowerCase();
425 		if ("funicular".equals(a)||"light_rail".equals(a)||"monorail".equals(a)){
426 			gisfeature = new Rail();
427 		} else if ("station".equals(a)||"tram_stop".equals(a)||"subway_entrance".equals(a)||"halt".equals(a) ){
428 			gisfeature = new RailRoadStation();
429 		} 
430 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
431 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
432 		gisfeature.setAmenity(a);
433 		return gisfeature;
434 
435 	}
436 
437 	GisFeature getBuildingObject(String building){
438 		GisFeature gisfeature = null;
439 		String a = null;
440 		if (building != null && !"".equals(building.trim()) ){
441 			a = building.trim().toLowerCase();
442 		}
443 		if ("hotel".equals(a)||"dormitory".equals(a)){
444 			gisfeature = new Hotel();
445 		} else if ("school".equals(a)||"university".equals(a)||"faculty".equals(a)){
446 			gisfeature = new School();
447 		}  else if ("supermarket".equals(a)){
448 			gisfeature = new Shop();
449 		} else if ("train_station".equals(a)){
450 			gisfeature = new RailRoadStation();
451 		} 
452 		else if ("cathedral".equals(a)||"chapel".equals(a)||"church".equals(a)||"mortuary".equals(a)){
453 			gisfeature = new Religious();
454 		} 
455 		else if ("city_hall".equals(a)){
456 			gisfeature = new CityHall();
457 		}
458 		else if ("farm".equals(a)){
459 			gisfeature = new Farm();
460 		} 
461 		else if ("hospital".equals(a)){
462 			gisfeature = new Hospital();
463 		} else {
464 			return null;
465 		}
466 
467 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
468 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
469 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
470 		gisfeature.setAmenity(a);
471 		return gisfeature;
472 
473 	}
474 
475 	GisFeature getHistoricObject(String historic){
476 		GisFeature gisfeature = null;
477 		String a = null;
478 		if (historic != null && !"".equals(historic.trim()) ){
479 			a = historic.trim().toLowerCase();
480 		}
481 		if ("castle".equals(a)||"manor".equals(a)){
482 			gisfeature = new Castle();
483 		} else if ("archeological_site".equals(a)||"city_gate".equals(a)||"fort".equals(a)||"memorial".equals(a)||"ruins".equals(a)||"rune_stone".equals(a)||"wreck".equals(a)||"monument".equals(a)){
484 			gisfeature = new Tourism();
485 		}  else if ("chapel".equals(a)||"monastery".equals(a)||"TOMB".equals(a)||"wayside_chapel".equals(a)){
486 			gisfeature = new Religious();
487 		}  else {
488 			return null;
489 		}
490 
491 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
492 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
493 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
494 		gisfeature.setAmenity(a);
495 		return gisfeature;
496 
497 	}
498 
499 	GisFeature getManMadeObject(String manMade){
500 		GisFeature gisfeature = null;
501 		String a = null;
502 		if (manMade != null && !"".equals(manMade.trim()) ){
503 			a = manMade.trim().toLowerCase();
504 		}
505 		if ("watermill".equals(a)||"windmill".equals(a)){
506 			gisfeature = new Mill();
507 		} else {
508 			return null;
509 		}
510 
511 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
512 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
513 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
514 		gisfeature.setAmenity(a);
515 		return gisfeature;
516 
517 	}
518 
519 	GisFeature getOfficeObject(String office){
520 		GisFeature gisfeature = null;
521 		String a = null;
522 		if (office != null && !"".equals(office.trim()) ){
523 			a = office.trim().toLowerCase();
524 		}
525 		if ("notary".equals(a)){
526 			gisfeature = new AdmBuilding();
527 		} else {
528 			return null;
529 		}
530 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
531 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
532 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
533 		gisfeature.setAmenity(a);
534 		return gisfeature;
535 
536 	}
537 
538 	GisFeature getCraftObject(String craft){
539 		GisFeature gisfeature = new Craft();
540 		String a = null;
541 		if (craft != null && !"".equals(craft.trim()) ){
542 			a = craft.trim().toLowerCase();
543 		} else {
544 			return null;//if no craft, we return null
545 		}
546 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
547 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
548 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
549 		gisfeature.setAmenity(a);
550 		return gisfeature;
551 
552 	}
553 
554 	GisFeature getShopObject(String shop){
555 		String a = null;
556 		if (isNonRealTag(shop)){
557 			return null;
558 		} 
559 		a = shop.trim().toLowerCase();
560 		GisFeature gisfeature = new Shop();
561 
562 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
563 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
564 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
565 		gisfeature.setAmenity(a);
566 		return gisfeature;
567 	}
568 
569 	GisFeature getSportObject(String sport){
570 		String a = null;
571 		if (isNonRealTag(sport) ){
572 			return null;
573 		} 
574 		a = sport.trim().toLowerCase();
575 		GisFeature gisfeature = new Sport();
576 
577 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
578 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
579 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
580 		gisfeature.setAmenity(a);
581 		return gisfeature;
582 
583 	}
584 
585 	
586 
587 
588 
589 	GisFeature getLanduseObject(String landuse){
590 		GisFeature gisfeature = null;
591 		String a = null;
592 		if (landuse != null && !"".equals(landuse.trim()) ){
593 			a = landuse.trim().toLowerCase();
594 		}
595 		if ("cemetery".equals(a)){
596 			gisfeature = new Cemetery();
597 		} else {
598 			return null;
599 		}
600 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
601 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
602 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
603 		gisfeature.setAmenity(a);
604 		return gisfeature;
605 
606 	}
607 
608 	GisFeature getHighwayObject(String highway){
609 		GisFeature gisfeature = null;
610 		String a = null;
611 		if (highway != null && !"".equals(highway.trim()) ){
612 			a = highway.trim().toLowerCase();
613 		}
614 		if ("bus_stop".equals(a)){
615 			gisfeature = new BusStation();
616 		} else {
617 			return null;
618 		}
619 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
620 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
621 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
622 		gisfeature.setAmenity(a);
623 		return gisfeature;
624 
625 	}
626 
627 	//'common','dance','fishing','garden','golf','golf_course','ice_rink','marina','miniature_golf','nature_reserve','park' , 'pitch','playground','sports_center','stadium','swimming_pool','water_park')
628 	GisFeature getLeisureObject(String tourism){
629 		GisFeature gisfeature = null;
630 		String a = null;
631 		if (tourism != null && !"".equals(tourism.trim()) ){
632 			a = tourism.trim().toLowerCase();
633 		} if ("common".equals(a)){
634 			return null;
635 		} else if ("dance".equals(a)){
636 			gisfeature = new NightClub();
637 		} else if ("fishing".equals(a)||"hostel".equals(a)||"hotel".equals(a)||"motel".equals(a)){
638 			gisfeature = new FishingArea();
639 		}  else if ("garden".equals(a)){
640 			gisfeature = new Garden();
641 		} else if ("golf".equals(a) || "golf_course".equals(a)){
642 			gisfeature = new Golf();
643 		}  else if ("ice_rink".equals(a)){
644 			gisfeature = new Ice();
645 		} else if ("marina".equals(a)){
646 			gisfeature = new Port();
647 		} else if ("nature_reserve".equals(a)){
648 			gisfeature = new Reserve();
649 		} else if ("park".equals(a)){
650 			gisfeature = new Park();
651 		}  else if ("pitch".equals(a)||"sports_center".equals(a)){
652 			gisfeature = new Sport();
653 		}  else if ("playground".equals(a)){
654 			gisfeature = new AmusePark();
655 		} else if ("stadium".equals(a)){
656 			gisfeature = new Stadium();
657 		}  else if ("swimming_pool".equals(a)){
658 			gisfeature = new SwimmingPool();
659 		} else if ("water_park".equals(a)){
660 			gisfeature = new AmusePark();
661 		}  else {
662 			return null;
663 		}
664 
665 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
666 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
667 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
668 		gisfeature.setAmenity(a);
669 		return gisfeature;
670 
671 	}
672 
673 	GisFeature getTourismObject(String tourism){
674 		GisFeature gisfeature = null;
675 		String a = null;
676 		if (tourism != null && !"".equals(tourism.trim()) ){
677 			a = tourism.trim().toLowerCase();
678 		}
679 		if ("camp_site".equals(a)||"caravan_site".equals(a)){
680 			gisfeature = new Camping();
681 		} else if ("guest_house".equals(a)||"hostel".equals(a)||"hotel".equals(a)||"motel".equals(a)){
682 			gisfeature = new Hotel();
683 		}  else if ("information".equals(a)){
684 			gisfeature = new TourismInfo();
685 		} else if ("museum".equals(a)){
686 			gisfeature = new Museum();
687 		}  else if ("picnic_site".equals(a)){
688 			gisfeature = new Picnic();
689 		} else if ("theme_park".equals(a)){
690 			gisfeature = new AmusePark();
691 		}  else if ("viewpoint".equals(a)){
692 			gisfeature = new ObservatoryPoint();
693 		} else if ("zoo".equals(a)){
694 			gisfeature = new Zoo();
695 		} else if ("artwork".equals(a)){
696 			gisfeature = new Tourism();
697 		}  else {
698 			return null;
699 		}
700 
701 		gisfeature.setFeatureClass(gisfeature.getClass().getSimpleName().toUpperCase());
702 		gisfeature.setFeatureCode(DEFAULT_OSM_FEATURE_CODE);
703 		gisfeature.setFeatureClass(DEFAULT_OSM_FEATURE_CLASS);
704 		gisfeature.setAmenity(a);
705 		return gisfeature;
706 
707 	}
708 
709 
710 
711 
712 
713 }